use of org.pac4j.core.credentials.authenticator.Authenticator in project cas by apereo.
the class CasOAuthConfiguration method oauthSecConfig.
@Bean
public Config oauthSecConfig() {
final CasConfiguration cfg = new CasConfiguration(casProperties.getServer().getLoginUrl());
final CasClient oauthCasClient = new CasClient(cfg);
oauthCasClient.setRedirectActionBuilder(webContext -> oauthCasClientRedirectActionBuilder().build(oauthCasClient, webContext));
oauthCasClient.setName(Authenticators.CAS_OAUTH_CLIENT);
oauthCasClient.setUrlResolver(casCallbackUrlResolver());
final Authenticator authenticator = oAuthClientAuthenticator();
final DirectBasicAuthClient basicAuthClient = new DirectBasicAuthClient(authenticator);
basicAuthClient.setName(Authenticators.CAS_OAUTH_CLIENT_BASIC_AUTHN);
final DirectFormClient directFormClient = new DirectFormClient(authenticator);
directFormClient.setName(Authenticators.CAS_OAUTH_CLIENT_DIRECT_FORM);
directFormClient.setUsernameParameter(CLIENT_ID);
directFormClient.setPasswordParameter(CLIENT_SECRET);
final DirectFormClient userFormClient = new DirectFormClient(oAuthUserAuthenticator());
userFormClient.setName(Authenticators.CAS_OAUTH_CLIENT_USER_FORM);
final Config config = new Config(OAuth20Utils.casOAuthCallbackUrl(casProperties.getServer().getPrefix()), oauthCasClient, basicAuthClient, directFormClient, userFormClient);
config.setSessionStore(new J2ESessionStore());
return config;
}
Aggregations