Search in sources :

Example 1 with BasicAuthModule

use of org.eclipse.jetty.security.jaspi.modules.BasicAuthModule in project cdap by caskdata.

the class JASPIAuthenticationHandler method getHandlerAuthenticator.

@Override
protected Authenticator getHandlerAuthenticator() {
    JaspiAuthenticatorFactory jaspiAuthenticatorFactory = new JaspiAuthenticatorFactory();
    jaspiAuthenticatorFactory.setLoginService(getHandlerLoginService());
    HashMap<String, ServerAuthContext> serverAuthContextMap = new HashMap<>();
    ServletCallbackHandler callbackHandler = new ServletCallbackHandler(getHandlerLoginService());
    ServerAuthModule authModule = new BasicAuthModule(callbackHandler, "JAASRealm");
    serverAuthContextMap.put("authContextID", new ServerAuthContextImpl(Collections.singletonList(authModule)));
    ServerAuthContextType serverAuthContextType = new ServerAuthContextType("HTTP", "server *", "authContextID", new AuthModuleType<ServerAuthModule>());
    ServerAuthConfigType serverAuthConfigType = new ServerAuthConfigType(serverAuthContextType, true);
    ServerAuthConfig serverAuthConfig = new ServerAuthConfigImpl(serverAuthConfigType, serverAuthContextMap);
    return new JaspiAuthenticator(serverAuthConfig, null, callbackHandler, new Subject(), true, getHandlerIdentityService());
}
Also used : ServerAuthConfigImpl(org.apache.geronimo.components.jaspi.impl.ServerAuthConfigImpl) JaspiAuthenticatorFactory(org.eclipse.jetty.security.jaspi.JaspiAuthenticatorFactory) HashMap(java.util.HashMap) ServerAuthModule(javax.security.auth.message.module.ServerAuthModule) ServerAuthContextImpl(org.apache.geronimo.components.jaspi.impl.ServerAuthContextImpl) JaspiAuthenticator(org.eclipse.jetty.security.jaspi.JaspiAuthenticator) Subject(javax.security.auth.Subject) ServerAuthContext(javax.security.auth.message.config.ServerAuthContext) BasicAuthModule(org.eclipse.jetty.security.jaspi.modules.BasicAuthModule) ServerAuthContextType(org.apache.geronimo.components.jaspi.model.ServerAuthContextType) ServerAuthConfigType(org.apache.geronimo.components.jaspi.model.ServerAuthConfigType) ServerAuthConfig(javax.security.auth.message.config.ServerAuthConfig) ServletCallbackHandler(org.eclipse.jetty.security.jaspi.ServletCallbackHandler)

Aggregations

HashMap (java.util.HashMap)1 Subject (javax.security.auth.Subject)1 ServerAuthConfig (javax.security.auth.message.config.ServerAuthConfig)1 ServerAuthContext (javax.security.auth.message.config.ServerAuthContext)1 ServerAuthModule (javax.security.auth.message.module.ServerAuthModule)1 ServerAuthConfigImpl (org.apache.geronimo.components.jaspi.impl.ServerAuthConfigImpl)1 ServerAuthContextImpl (org.apache.geronimo.components.jaspi.impl.ServerAuthContextImpl)1 ServerAuthConfigType (org.apache.geronimo.components.jaspi.model.ServerAuthConfigType)1 ServerAuthContextType (org.apache.geronimo.components.jaspi.model.ServerAuthContextType)1 JaspiAuthenticator (org.eclipse.jetty.security.jaspi.JaspiAuthenticator)1 JaspiAuthenticatorFactory (org.eclipse.jetty.security.jaspi.JaspiAuthenticatorFactory)1 ServletCallbackHandler (org.eclipse.jetty.security.jaspi.ServletCallbackHandler)1 BasicAuthModule (org.eclipse.jetty.security.jaspi.modules.BasicAuthModule)1