use of io.vertx.reactivex.ext.web.handler.SessionHandler in project gravitee-access-management by gravitee-io.
the class AuthorizationEndpointTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
AuthorizationEndpoint authorizationEndpointHandler = new AuthorizationEndpoint(flow, thymeleafTemplateEngine, parService);
// set openid provider service
OpenIDProviderMetadata openIDProviderMetadata = new OpenIDProviderMetadata();
openIDProviderMetadata.setResponseTypesSupported(Arrays.asList(ResponseType.CODE, ResponseType.TOKEN, io.gravitee.am.common.oidc.ResponseType.CODE_ID_TOKEN, io.gravitee.am.common.oidc.ResponseType.CODE_TOKEN, io.gravitee.am.common.oidc.ResponseType.CODE_ID_TOKEN_TOKEN, io.gravitee.am.common.oidc.ResponseType.ID_TOKEN_TOKEN, io.gravitee.am.common.oidc.ResponseType.ID_TOKEN));
openIDProviderMetadata.setResponseModesSupported(Arrays.asList(io.gravitee.am.common.oauth2.ResponseMode.QUERY, io.gravitee.am.common.oauth2.ResponseMode.FRAGMENT, ResponseMode.QUERY_JWT, ResponseMode.FRAGMENT_JWT, ResponseMode.JWT));
when(openIDDiscoveryService.getConfiguration(anyString())).thenReturn(openIDProviderMetadata);
when(environment.getProperty("authorization.code.validity", Integer.class, 60000)).thenReturn(60000);
// set technical routes
SessionHandler sessionHandler = SessionHandler.create(LocalSessionStore.create(vertx));
router.route().order(-1).handler(sessionHandler).handler(routingContext -> {
routingContext.put(CONTEXT_PATH, "/test");
routingContext.next();
});
// set Authorization endpoint routes
router.route(HttpMethod.GET, "/oauth/authorize").handler(new AuthorizationRequestParseProviderConfigurationHandler(openIDDiscoveryService)).handler(new AuthorizationRequestParseRequiredParametersHandler()).handler(new AuthorizationRequestParseClientHandler(clientSyncService)).handler(new AuthorizationRequestParseParametersHandler(domain)).handler(new AuthorizationRequestResolveHandler(scopeManager)).handler(authorizationEndpointHandler);
router.route().failureHandler(new AuthorizationRequestFailureHandler(openIDDiscoveryService, jwtService, jweService, environment));
when(parService.deleteRequestUri(any())).thenReturn(Completable.complete());
}
Aggregations