Search in sources :

Example 6 with AuthenticationMechanism

use of io.undertow.security.api.AuthenticationMechanism in project cxf by apache.

the class UndertowDigestAuthHandler method buildSecurityHandler.

private void buildSecurityHandler() {
    HttpHandler handler = this.next;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    final List<AuthenticationMechanism> mechanisms = Collections.<AuthenticationMechanism>singletonList(new DigestAuthenticationMechanism("WSRealm", "WSDomain", "DIGEST", this.identityManager));
    handler = new AuthenticationMechanismsHandler(handler, mechanisms);
    this.securityHandler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, handler);
}
Also used : CXFUndertowHttpHandler(org.apache.cxf.transport.http_undertow.CXFUndertowHttpHandler) HttpHandler(io.undertow.server.HttpHandler) AuthenticationConstraintHandler(io.undertow.security.handlers.AuthenticationConstraintHandler) DigestAuthenticationMechanism(io.undertow.security.impl.DigestAuthenticationMechanism) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) DigestAuthenticationMechanism(io.undertow.security.impl.DigestAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler)

Example 7 with AuthenticationMechanism

use of io.undertow.security.api.AuthenticationMechanism in project runwar by cfmlprojects.

the class SecurityManager method addSecurity.

public HttpHandler addSecurity(final HttpHandler toWrap, final Map<String, String> users, String realm) {
    for (String userName : users.keySet()) {
        addUser(userName, users.get(userName), "role1");
    }
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    final List<AuthenticationMechanism> mechanisms = Collections.<AuthenticationMechanism>singletonList(new BasicAuthenticationMechanism(realm));
    handler = new AuthenticationMechanismsHandler(handler, mechanisms);
    handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, this, handler);
    return handler;
}
Also used : HttpHandler(io.undertow.server.HttpHandler) AuthenticationConstraintHandler(io.undertow.security.handlers.AuthenticationConstraintHandler) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism)

Example 8 with AuthenticationMechanism

use of io.undertow.security.api.AuthenticationMechanism in project tutorials by eugenp.

the class SecureServer method addSecurity.

private static HttpHandler addSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    final List<AuthenticationMechanism> mechanisms = Collections.singletonList(new BasicAuthenticationMechanism("Baeldung_Realm"));
    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) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism)

Example 9 with AuthenticationMechanism

use of io.undertow.security.api.AuthenticationMechanism in project iri by iotaledger.

the class API method addSecurity.

private HttpHandler addSecurity(final HttpHandler toWrap) {
    String credentials = instance.configuration.string(DefaultConfSettings.REMOTE_AUTH);
    if (credentials == null || credentials.isEmpty()) {
        return toWrap;
    }
    final Map<String, char[]> users = new HashMap<>(2);
    users.put(credentials.split(":")[0], credentials.split(":")[1].toCharArray());
    IdentityManager identityManager = new MapIdentityManager(users);
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    final List<AuthenticationMechanism> mechanisms = Collections.singletonList(new BasicAuthenticationMechanism("Iota Realm"));
    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) IdentityManager(io.undertow.security.idm.IdentityManager) MapIdentityManager(com.iota.iri.utils.MapIdentityManager) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) HttpString(io.undertow.util.HttpString) MapIdentityManager(com.iota.iri.utils.MapIdentityManager) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism)

Example 10 with AuthenticationMechanism

use of io.undertow.security.api.AuthenticationMechanism in project undertow by undertow-io.

the class BasicAuthServer method addSecurity.

private static HttpHandler addSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {
    HttpHandler handler = toWrap;
    handler = new AuthenticationCallHandler(handler);
    handler = new AuthenticationConstraintHandler(handler);
    final List<AuthenticationMechanism> mechanisms = Collections.<AuthenticationMechanism>singletonList(new BasicAuthenticationMechanism("My Realm"));
    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) SecurityInitialHandler(io.undertow.security.handlers.SecurityInitialHandler) AuthenticationMechanismsHandler(io.undertow.security.handlers.AuthenticationMechanismsHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism) AuthenticationMechanism(io.undertow.security.api.AuthenticationMechanism) AuthenticationCallHandler(io.undertow.security.handlers.AuthenticationCallHandler) BasicAuthenticationMechanism(io.undertow.security.impl.BasicAuthenticationMechanism)

Aggregations

AuthenticationMechanism (io.undertow.security.api.AuthenticationMechanism)16 AuthenticationMechanismsHandler (io.undertow.security.handlers.AuthenticationMechanismsHandler)12 SecurityInitialHandler (io.undertow.security.handlers.SecurityInitialHandler)12 HttpHandler (io.undertow.server.HttpHandler)12 AuthenticationCallHandler (io.undertow.security.handlers.AuthenticationCallHandler)11 AuthenticationConstraintHandler (io.undertow.security.handlers.AuthenticationConstraintHandler)11 BasicAuthenticationMechanism (io.undertow.security.impl.BasicAuthenticationMechanism)10 DigestAuthenticationMechanism (io.undertow.security.impl.DigestAuthenticationMechanism)5 CachedAuthenticatedSessionMechanism (io.undertow.security.impl.CachedAuthenticatedSessionMechanism)4 ArrayList (java.util.ArrayList)4 NotificationReceiver (io.undertow.security.api.NotificationReceiver)3 NotificationReceiverHandler (io.undertow.security.handlers.NotificationReceiverHandler)3 IdentityManager (io.undertow.security.idm.IdentityManager)3 DigestQop (io.undertow.security.impl.DigestQop)3 SimpleNonceManager (io.undertow.security.impl.SimpleNonceManager)3 HttpServerExchange (io.undertow.server.HttpServerExchange)3 AuthenticationMechanismFactory (io.undertow.security.api.AuthenticationMechanismFactory)2 AuthenticationMode (io.undertow.security.api.AuthenticationMode)2 DigestAlgorithm (io.undertow.security.idm.DigestAlgorithm)2 FormAuthenticationMechanism (io.undertow.security.impl.FormAuthenticationMechanism)2