Search in sources :

Example 1 with LightBasicAuthenticationMechanism

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

the class PathHandlerProvider method addGetSecurity.

private HttpHandler addGetSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    List<AuthenticationMechanism> mechanisms = new ArrayList<>();
    // bypass the SPNEGO if service password is not even configured.
    if (spnegoServicePassword != null) {
        mechanisms.add(new LightGSSAPIAuthenticationMechanism(new SubjectFactory()));
    }
    mechanisms.add(new LightBasicAuthenticationMechanism("OAuth"));
    handler = new AuthenticationMechanismsHandler(handler, mechanisms);
    handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, handler);
    return handler;
}
Also used : HttpHandler(io.undertow.server.HttpHandler) AuthenticationConstraintHandler(io.undertow.security.handlers.AuthenticationConstraintHandler) LightGSSAPIAuthenticationMechanism(com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism) GSSAPIServerSubjectFactory(io.undertow.security.api.GSSAPIServerSubjectFactory) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) LightBasicAuthenticationMechanism(com.networknt.oauth.security.LightBasicAuthenticationMechanism) LightGSSAPIAuthenticationMechanism(com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) FormAuthenticationMechanism(io.undertow.security.impl.FormAuthenticationMechanism) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) ArrayList(java.util.ArrayList) LightBasicAuthenticationMechanism(com.networknt.oauth.security.LightBasicAuthenticationMechanism)

Example 2 with LightBasicAuthenticationMechanism

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

the class BaseWrapper method addGetSecurity.

protected HttpHandler addGetSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    List<AuthenticationMechanism> mechanisms = new ArrayList<>();
    // bypass the SPNEGO if service password is not even configured.
    if (spnegoServicePassword != null) {
        mechanisms.add(new LightGSSAPIAuthenticationMechanism(new SubjectFactory()));
    }
    mechanisms.add(new LightBasicAuthenticationMechanism("OAuth"));
    handler = new AuthenticationMechanismsHandler(handler, mechanisms);
    handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, handler);
    return handler;
}
Also used : HttpHandler(io.undertow.server.HttpHandler) AuthenticationConstraintHandler(io.undertow.security.handlers.AuthenticationConstraintHandler) LightGSSAPIAuthenticationMechanism(com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism) GSSAPIServerSubjectFactory(io.undertow.security.api.GSSAPIServerSubjectFactory) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) LightFormAuthenticationMechanism(com.networknt.oauth.security.LightFormAuthenticationMechanism) LightGSSAPIAuthenticationMechanism(com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism) LightBasicAuthenticationMechanism(com.networknt.oauth.security.LightBasicAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) ArrayList(java.util.ArrayList) LightBasicAuthenticationMechanism(com.networknt.oauth.security.LightBasicAuthenticationMechanism)

Aggregations

LightBasicAuthenticationMechanism (com.networknt.oauth.security.LightBasicAuthenticationMechanism)2 LightGSSAPIAuthenticationMechanism (com.networknt.oauth.security.LightGSSAPIAuthenticationMechanism)2 AuthenticationMechanism (io.undertow.security.api.AuthenticationMechanism)2 GSSAPIServerSubjectFactory (io.undertow.security.api.GSSAPIServerSubjectFactory)2 AuthenticationCallHandler (io.undertow.security.handlers.AuthenticationCallHandler)2 AuthenticationConstraintHandler (io.undertow.security.handlers.AuthenticationConstraintHandler)2 AuthenticationMechanismsHandler (io.undertow.security.handlers.AuthenticationMechanismsHandler)2 SecurityInitialHandler (io.undertow.security.handlers.SecurityInitialHandler)2 HttpHandler (io.undertow.server.HttpHandler)2 ArrayList (java.util.ArrayList)2 LightFormAuthenticationMechanism (com.networknt.oauth.security.LightFormAuthenticationMechanism)1 FormAuthenticationMechanism (io.undertow.security.impl.FormAuthenticationMechanism)1