Search in sources :

Example 6 with ServerAuthContext

use of javax.security.auth.message.config.ServerAuthContext in project tomcat by apache.

the class TestSimpleServerAuthConfig method testConfigOnServerAuthConfig.

@Test
public void testConfigOnServerAuthConfig() throws Exception {
    ServerAuthConfig serverAuthConfig = new SimpleServerAuthConfig(null, null, null, CONFIG_PROPERTIES);
    ServerAuthContext serverAuthContext = serverAuthConfig.getAuthContext(null, null, null);
    validateServerAuthContext(serverAuthContext);
}
Also used : ServerAuthConfig(javax.security.auth.message.config.ServerAuthConfig) ServerAuthContext(javax.security.auth.message.config.ServerAuthContext) Test(org.junit.Test)

Example 7 with ServerAuthContext

use of javax.security.auth.message.config.ServerAuthContext 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

ServerAuthContext (javax.security.auth.message.config.ServerAuthContext)7 AuthException (javax.security.auth.message.AuthException)4 ServerAuthConfig (javax.security.auth.message.config.ServerAuthConfig)4 Subject (javax.security.auth.Subject)3 Principal (java.security.Principal)2 HashMap (java.util.HashMap)2 AuthStatus (javax.security.auth.message.AuthStatus)2 ServerAuthModule (javax.security.auth.message.module.ServerAuthModule)2 ServerAuthException (org.eclipse.jetty.security.ServerAuthException)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 MessageInfo (javax.security.auth.message.MessageInfo)1 CallerPrincipalCallback (javax.security.auth.message.callback.CallerPrincipalCallback)1 GroupPrincipalCallback (javax.security.auth.message.callback.GroupPrincipalCallback)1 AuthConfigProvider (javax.security.auth.message.config.AuthConfigProvider)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 HttpSession (javax.servlet.http.HttpSession)1 TomcatPrincipal (org.apache.catalina.TomcatPrincipal)1