Search in sources :

Example 1 with LightFormAuthenticationMechanism

use of com.networknt.oauth.security.LightFormAuthenticationMechanism in project light-oauth2 by networknt.

the class BaseWrapper method addFormSecurity.

protected HttpHandler addFormSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    final List<AuthenticationMechanism> mechanisms = new ArrayList<>();
    mechanisms.add(new CachedAuthenticatedSessionMechanism());
    mechanisms.add(new LightFormAuthenticationMechanism("oauth2", "/login", "/error", "/oauth2/code"));
    handler = new AuthenticationMechanismsHandler(handler, mechanisms);
    handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, handler);
    handler = new SessionAttachmentHandler(handler, new InMemorySessionManager("oauth2"), new SessionCookieConfig());
    return handler;
}
Also used : HttpHandler(io.undertow.server.HttpHandler) AuthenticationConstraintHandler(io.undertow.security.handlers.AuthenticationConstraintHandler) CachedAuthenticatedSessionMechanism(io.undertow.security.impl.CachedAuthenticatedSessionMechanism) LightFormAuthenticationMechanism(com.networknt.oauth.security.LightFormAuthenticationMechanism) LightGSSAPIAuthenticationMechanism(com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism) LightBasicAuthenticationMechanism(com.networknt.oauth.security.LightBasicAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) ArrayList(java.util.ArrayList) LightFormAuthenticationMechanism(com.networknt.oauth.security.LightFormAuthenticationMechanism) SessionAttachmentHandler(io.undertow.server.session.SessionAttachmentHandler) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) SessionCookieConfig(io.undertow.server.session.SessionCookieConfig) InMemorySessionManager(io.undertow.server.session.InMemorySessionManager)

Aggregations

LightBasicAuthenticationMechanism (com.networknt.oauth.security.LightBasicAuthenticationMechanism)1 LightFormAuthenticationMechanism (com.networknt.oauth.security.LightFormAuthenticationMechanism)1 LightGSSAPIAuthenticationMechanism (com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism)1 AuthenticationMechanism (io.undertow.security.api.AuthenticationMechanism)1 AuthenticationCallHandler (io.undertow.security.handlers.AuthenticationCallHandler)1 AuthenticationConstraintHandler (io.undertow.security.handlers.AuthenticationConstraintHandler)1 AuthenticationMechanismsHandler (io.undertow.security.handlers.AuthenticationMechanismsHandler)1 SecurityInitialHandler (io.undertow.security.handlers.SecurityInitialHandler)1 CachedAuthenticatedSessionMechanism (io.undertow.security.impl.CachedAuthenticatedSessionMechanism)1 HttpHandler (io.undertow.server.HttpHandler)1 InMemorySessionManager (io.undertow.server.session.InMemorySessionManager)1 SessionAttachmentHandler (io.undertow.server.session.SessionAttachmentHandler)1 SessionCookieConfig (io.undertow.server.session.SessionCookieConfig)1 ArrayList (java.util.ArrayList)1