use of org.apereo.cas.support.oauth.authenticator.OAuthClientAuthenticator in project cas by apereo.
the class CasOAuthConfiguration method oauthSecConfig.
@RefreshScope
@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);
return new Config(OAuthUtils.casOAuthCallbackUrl(casProperties.getServer().getPrefix()), oauthCasClient, basicAuthClient, directFormClient, userFormClient);
}
Aggregations