use of org.apereo.cas.authentication.principal.Service in project cas by apereo.
the class WSFederationValidateRequestController method handleLogoutRequest.
private void handleLogoutRequest(final WSFederationRequest fedRequest, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
String logoutUrl = casProperties.getServer().getLogoutUrl();
if (StringUtils.isNotBlank(fedRequest.getWreply())) {
final Service service = webApplicationServiceFactory.createService(fedRequest.getWreply());
final WSFederationRegisteredService registeredService = getWsFederationRegisteredService(service);
LOGGER.debug("Invoking logout operation for request [{}], redirecting next to [{}] matched against [{}]", fedRequest, fedRequest.getWreply(), registeredService);
final String logoutParam = casProperties.getLogout().getRedirectParameter();
logoutUrl = logoutUrl.concat("?").concat(logoutParam).concat("=").concat(service.getId());
}
final AuthenticationRedirectStrategy authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
authenticationRedirectStrategy.redirect(request, response, logoutUrl);
}
use of org.apereo.cas.authentication.principal.Service in project cas by apereo.
the class SecurityTokenServiceAuthenticationPostProcessor method process.
@Override
public void process(final AuthenticationTransaction transaction, final AuthenticationBuilder builder) {
if (!this.selectionStrategy.supports(transaction.getService())) {
return;
}
final Service service = this.selectionStrategy.resolveServiceFrom(transaction.getService());
if (service != null) {
final WSFederationRegisteredService rp = this.servicesManager.findServiceBy(service, WSFederationRegisteredService.class);
if (rp == null || !rp.getAccessStrategy().isServiceAccessAllowed()) {
LOGGER.warn("Service [{}] is not allowed to use SSO.", rp);
throw new UnauthorizedSsoServiceException();
}
final SecurityTokenServiceClient sts = clientBuilder.buildClientForSecurityTokenRequests(rp);
invokeSecurityTokenServiceForToken(transaction, builder, rp, sts);
}
}
Aggregations