@Test public void shouldResolveTokenRequest_withUser_permissionsRequestedNone() { final String scope = "read"; final List<String> userScopes = Arrays.asList("user1", "user2", "user3"); TokenRequest tokenRequest = new TokenRequest(); List<String> reqScopes = new ArrayList<>(); reqScopes.add(scope); tokenRequest.setScopes(new HashSet<>(reqScopes)); Client client = new Client(); client.setEnhanceScopesWithUserPermissions(true); client.setScopes(Collections.singletonList(scope)); User user = new User(); Role role = new Role(); role.setOauthScopes(userScopes); user.setRolesPermissions(Collections.singleton(role)); TestObserver<TokenRequest> testObserver = tokenRequestResolver.resolve(tokenRequest, client, user).test(); testObserver.assertComplete(); testObserver.assertNoErrors(); List<String> expectedScopes = new ArrayList<>(); expectedScopes.add(scope); expectedScopes.addAll(userScopes); testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4); }
public Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser) { return resolveAuthorizedScopes(tokenRequest, client, endUser); }
TokenRequestResolver extends AbstractRequestResolver<TokenRequest> { public Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser) { return resolveAuthorizedScopes(tokenRequest, client, endUser); } }
TokenRequestResolver extends AbstractRequestResolver<TokenRequest> { public Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser) { return resolveAuthorizedScopes(tokenRequest, client, endUser); }  }
TokenRequestResolver extends AbstractRequestResolver<TokenRequest> { public Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser) { return resolveAuthorizedScopes(tokenRequest, client, endUser); }  Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser); }
TokenRequestResolver extends AbstractRequestResolver<TokenRequest> { public Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser) { return resolveAuthorizedScopes(tokenRequest, client, endUser); }  Single<TokenRequest> resolve(TokenRequest tokenRequest, Client client, User endUser);  }