use of io.undertow.security.impl.BasicAuthenticationMechanism in project syncany by syncany.
the class WebServer method addSecurity.
private static HttpHandler addSecurity(final HttpHandler toWrap, IdentityManager identityManager) {
List<AuthenticationMechanism> mechanisms = Collections.<AuthenticationMechanism>singletonList(new BasicAuthenticationMechanism("Syncany"));
HttpHandler handler = toWrap;
handler = new AuthenticationCallHandler(handler);
handler = new AuthenticationConstraintHandler(handler);
handler = new AuthenticationMechanismsHandler(handler, mechanisms);
handler = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, handler);
return handler;
}
use of io.undertow.security.impl.BasicAuthenticationMechanism in project undertow by undertow-io.
the class SsoTestCase method setup.
@BeforeClass
public static void setup() {
final SingleSignOnAuthenticationMechanism sso = new SingleSignOnAuthenticationMechanism(new InMemorySingleSignOnManager());
final PathHandler path = new PathHandler();
HttpHandler current = new ResponseHandler();
current = new AuthenticationCallHandler(current);
current = new AuthenticationConstraintHandler(current);
List<AuthenticationMechanism> mechs = new ArrayList<>();
mechs.add(sso);
mechs.add(new BasicAuthenticationMechanism("Test Realm"));
current = new AuthenticationMechanismsHandler(current, mechs);
current = new NotificationReceiverHandler(current, Collections.<NotificationReceiver>singleton(auditReceiver));
current = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, current);
path.addPrefixPath("/test1", current);
current = new ResponseHandler();
current = new AuthenticationCallHandler(current);
current = new AuthenticationConstraintHandler(current);
mechs = new ArrayList<>();
mechs.add(sso);
mechs.add(new FormAuthenticationMechanism("form", "/login", "/error"));
current = new AuthenticationMechanismsHandler(current, mechs);
current = new NotificationReceiverHandler(current, Collections.<NotificationReceiver>singleton(auditReceiver));
current = new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, identityManager, current);
path.addPrefixPath("/test2", current);
path.addPrefixPath("/login", new ResponseCodeHandler(StatusCodes.UNAUTHORIZED));
DefaultServer.setRootHandler(new SessionAttachmentHandler(path, new InMemorySessionManager(""), new SessionCookieConfig()));
}
use of io.undertow.security.impl.BasicAuthenticationMechanism 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;
}
Aggregations