use of org.eclipse.jetty.security.jaspi.JaspiAuthenticatorFactory 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());
}
Aggregations