Search in sources :

Example 1 with SessionManager

use of com.predic8.membrane.core.interceptor.authentication.session.SessionManager in project service-proxy by membrane.

the class OAuth2AuthorizationServerInterceptor method init.

@Override
public void init(Router router) throws Exception {
    name = "OAuth 2 Authorization Server";
    setFlow(Flow.Set.REQUEST_RESPONSE);
    this.setRouter(router);
    addSupportedAuthorizationGrants();
    getWellknownFile().init(router, this);
    getConsentPageFile().init(router, getConsentFile());
    if (userDataProvider == null)
        throw new Exception("No userDataProvider configured. - Cannot work without one.");
    if (getClientList() == null)
        throw new Exception("No clientList configured. - Cannot work without one.");
    if (getClaimList() == null)
        throw new Exception("No scopeList configured. - Cannot work without one");
    if (getLocation() == null) {
        log.warn("===========================================================================================");
        log.warn("IMPORTANT: No location configured - Authorization code and implicit flows are not available");
        log.warn("===========================================================================================");
        loginViewDisabled = true;
    }
    if (getConsentFile() == null && !isLoginViewDisabled()) {
        log.warn("==============================================================================================");
        log.warn("IMPORTANT: No consentFile configured - Authorization code and implicit flows are not available");
        log.warn("==============================================================================================");
        loginViewDisabled = true;
    }
    if (getPath() == null)
        throw new Exception("No path configured. - Cannot work without one");
    userDataProvider.init(router);
    getClientList().init(router);
    getClaimList().init(router);
    jwtGenerator = new JwtGenerator();
    sessionManager.init(router);
    statistics = new OAuth2Statistics();
    addDefaultProcessors();
    new CleanupThread(sessionManager, accountBlocker).start();
}
Also used : JwtGenerator(com.predic8.membrane.core.interceptor.oauth2.tokengenerators.JwtGenerator) CleanupThread(com.predic8.membrane.core.interceptor.authentication.session.CleanupThread)

Example 2 with SessionManager

use of com.predic8.membrane.core.interceptor.authentication.session.SessionManager in project service-proxy by membrane.

the class OAuth2ResourceInterceptor method init.

@Override
public void init(Router router) throws Exception {
    name = "OAuth 2 Client";
    setFlow(Flow.Set.REQUEST_RESPONSE);
    super.init(router);
    auth.init(router);
    statistics = new OAuth2Statistics();
    uriFactory = router.getUriFactory();
    if (sessionManager == null)
        sessionManager = new SessionManager();
    // TODO maybe do this differently as now the attribute in the bean is overwritten ( when set from external proxies.xml )
    sessionManager.setCookieName("SESSION_ID_CLIENT");
    sessionManager.init(router);
    if (loginLocation != null) {
        wsi = new WebServerInterceptor();
        wsi.setDocBase(loginLocation);
        router.getResolverMap().resolve(ResolverMap.combine(router.getBaseLocation(), wsi.getDocBase(), "./index.html")).close();
        wsi.init(router);
    }
    if (publicURL == null)
        initPublicURLOnFirstExchange = true;
    else
        normalizePublicURL();
    firstInitWhenDynamicAuthorizationService = getAuthService().supportsDynamicRegistration();
    if (!getAuthService().supportsDynamicRegistration())
        firstInitWhenDynamicAuthorizationService = false;
    new CleanupThread(sessionManager).start();
}
Also used : CleanupThread(com.predic8.membrane.core.interceptor.authentication.session.CleanupThread) SessionManager(com.predic8.membrane.core.interceptor.authentication.session.SessionManager) WebServerInterceptor(com.predic8.membrane.core.interceptor.server.WebServerInterceptor)

Aggregations

CleanupThread (com.predic8.membrane.core.interceptor.authentication.session.CleanupThread)2 SessionManager (com.predic8.membrane.core.interceptor.authentication.session.SessionManager)1 JwtGenerator (com.predic8.membrane.core.interceptor.oauth2.tokengenerators.JwtGenerator)1 WebServerInterceptor (com.predic8.membrane.core.interceptor.server.WebServerInterceptor)1