@Test public void when_endpoint_scope_same_as_token_scope_retunr_true() throws Exception { // GIVEN String tokenResponse = "{\"scope\":\"basic\",\"token_type\":\"Bearer\",\"userId\":\"12345\"}"; // WHEN boolean result = AccessTokenValidator.validateTokenScope(tokenResponse, "basic"); // THEN assertTrue(result); }
@Test public void when_token_but_scope_is_null_return_true() throws Exception { // GIVEN String endpointScope = null; String tokenContent = "{\"tokenType\":\"599\",\"scope\":\"basic other\"," + "\"accessToken\":\"da96c8141bcda91be65db4adbc8fafe77d116c88caacb8de404c0654c16c6620\"," + "\"expiresIn\":\"Bearer\",\"userId\":null," + "\"refreshToken\":\"cb2e2e068447913d0c97f79f888f6e2882bfcb569325a9ad9e9b52937b06e547\"}"; // WHEN boolean result = AccessTokenValidator.validateTokenScope(tokenContent, endpointScope); // THEN assertTrue(result); }