use of org.pac4j.core.engine.DefaultLogoutLogic in project cas by apereo.
the class CasConsentReviewConfiguration method casConsentPac4jConfig.
@Bean
@RefreshScope
public Config casConsentPac4jConfig() {
final CasConfiguration conf = new CasConfiguration(casProperties.getServer().getLoginUrl());
final CasClient client = new CasClient(conf);
client.setName(CAS_CONSENT_CLIENT);
client.setCallbackUrl(casProperties.getServer().getPrefix().concat("/consentReview/callback"));
client.setAuthorizationGenerator(new DefaultCasAuthorizationGenerator<>());
final Clients clients = new Clients(client);
final Config config = new Config(clients);
config.setAuthorizer(new IsAuthenticatedAuthorizer());
config.setCallbackLogic(new DefaultCallbackLogic());
config.setLogoutLogic(new DefaultLogoutLogic());
// get role authorizer from admin pages for smooth integration
final Map<String, Authorizer> adminAuthorizers = casAdminPagesPac4jConfig.getAuthorizers();
final String auth = RequireAnyRoleAuthorizer.class.getSimpleName();
if (adminAuthorizers.containsKey(auth)) {
config.addAuthorizer(auth, adminAuthorizers.get(auth));
final BaseClient adminClient = casAdminPagesPac4jConfig.getClients().findClient(DirectCasClient.class);
client.addAuthorizationGenerators(adminClient.getAuthorizationGenerators());
}
return config;
}
Aggregations