@Test public void shouldResolveAuthorizationRequest_userPermissionsRequestedAll() { final String scope = "read"; final List<String> userScopes = Arrays.asList("user1", "user2", "user3"); final String redirectUri = "http: AuthorizationRequest authorizationRequest = new AuthorizationRequest(); authorizationRequest.setRedirectUri(redirectUri); List<String> authScopes = new ArrayList<>(); authScopes.add(scope); authScopes.addAll(userScopes); authorizationRequest.setScopes(new HashSet<>(authScopes)); Client client = new Client(); client.setScopes(Collections.singletonList(scope)); client.setEnhanceScopesWithUserPermissions(true); User user = new User(); Role role = new Role(); role.setOauthScopes(userScopes); user.setRolesPermissions(Collections.singleton(role)); TestObserver<AuthorizationRequest> testObserver = authorizationRequestResolver.resolve(authorizationRequest, 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<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser) { return resolveAuthorizedScopes(authorizationRequest, client, endUser) .flatMap(request -> resolveRedirectUri(request, client)); }
AuthorizationRequestResolver extends AbstractRequestResolver<AuthorizationRequest> { public Single<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser) { return resolveAuthorizedScopes(authorizationRequest, client, endUser) .flatMap(request -> resolveRedirectUri(request, client)); } }
AuthorizationRequestResolver extends AbstractRequestResolver<AuthorizationRequest> { public Single<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser) { return resolveAuthorizedScopes(authorizationRequest, client, endUser) .flatMap(request -> resolveRedirectUri(request, client)); }  }
AuthorizationRequestResolver extends AbstractRequestResolver<AuthorizationRequest> { public Single<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser) { return resolveAuthorizedScopes(authorizationRequest, client, endUser) .flatMap(request -> resolveRedirectUri(request, client)); }  Single<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser); Single<AuthorizationRequest> resolveRedirectUri(AuthorizationRequest authorizationRequest, Client client); }
AuthorizationRequestResolver extends AbstractRequestResolver<AuthorizationRequest> { public Single<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser) { return resolveAuthorizedScopes(authorizationRequest, client, endUser) .flatMap(request -> resolveRedirectUri(request, client)); }  Single<AuthorizationRequest> resolve(AuthorizationRequest authorizationRequest, Client client, User endUser); Single<AuthorizationRequest> resolveRedirectUri(AuthorizationRequest authorizationRequest, Client client);  }