use of org.apereo.cas.services.DenyAllAttributeReleasePolicy in project cas by apereo.
the class DefaultAttributeReleasePolicyMapper method mapAttributeReleasePolicy.
@Override
public void mapAttributeReleasePolicy(final RegisteredServiceAttributeReleasePolicy policy, final RegisteredServiceEditBean.ServiceData bean) {
if (policy instanceof AbstractRegisteredServiceAttributeReleasePolicy) {
final AbstractRegisteredServiceAttributeReleasePolicy attrPolicy = (AbstractRegisteredServiceAttributeReleasePolicy) policy;
final RegisteredServiceAttributeReleasePolicyEditBean attrPolicyBean = bean.getAttrRelease();
attrPolicyBean.setReleasePassword(attrPolicy.isAuthorizedToReleaseCredentialPassword());
attrPolicyBean.setReleaseTicket(attrPolicy.isAuthorizedToReleaseProxyGrantingTicket());
attrPolicyBean.setExcludeDefault(attrPolicy.isExcludeDefaultAttributes());
this.attributeFilterMapper.mapAttributeFilter(attrPolicy.getAttributeFilter(), bean);
this.principalAttributesRepositoryMapper.mapPrincipalRepository(attrPolicy.getPrincipalAttributesRepository(), bean);
final RegisteredServiceAttributeReleasePolicyStrategyEditBean sBean = attrPolicyBean.getAttrPolicy();
if (attrPolicy instanceof ScriptedRegisteredServiceAttributeReleasePolicy) {
final ScriptedRegisteredServiceAttributeReleasePolicy policyS = (ScriptedRegisteredServiceAttributeReleasePolicy) attrPolicy;
sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.SCRIPT.toString());
sBean.setScriptFile(policyS.getScriptFile());
} else if (attrPolicy instanceof GroovyScriptAttributeReleasePolicy) {
final GroovyScriptAttributeReleasePolicy policyG = (GroovyScriptAttributeReleasePolicy) attrPolicy;
sBean.setScriptFile(policyG.getGroovyScript());
sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.GROOVY.toString());
} else if (attrPolicy instanceof ReturnAllAttributeReleasePolicy) {
sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.ALL.toString());
} else if (attrPolicy instanceof ReturnAllowedAttributeReleasePolicy) {
final ReturnAllowedAttributeReleasePolicy attrPolicyAllowed = (ReturnAllowedAttributeReleasePolicy) attrPolicy;
sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.ALLOWED.toString());
sBean.setAttributes(attrPolicyAllowed.getAllowedAttributes());
} else if (attrPolicy instanceof ReturnMappedAttributeReleasePolicy) {
final ReturnMappedAttributeReleasePolicy attrPolicyAllowed = (ReturnMappedAttributeReleasePolicy) attrPolicy;
sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.MAPPED.toString());
sBean.setAttributes(attrPolicyAllowed.getAllowedAttributes());
} else if (attrPolicy instanceof DenyAllAttributeReleasePolicy) {
sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.DENY.toString());
}
}
}
use of org.apereo.cas.services.DenyAllAttributeReleasePolicy in project cas by apereo.
the class CasOAuthConfiguration method initializeServletApplicationContext.
@PostConstruct
public void initializeServletApplicationContext() {
final String oAuthCallbackUrl = casProperties.getServer().getPrefix() + BASE_OAUTH20_URL + '/' + CALLBACK_AUTHORIZE_URL_DEFINITION;
final Service callbackService = this.webApplicationServiceFactory.createService(oAuthCallbackUrl);
final RegisteredService svc = servicesManager.findServiceBy(callbackService);
if (svc == null || !svc.getServiceId().equals(oAuthCallbackUrl)) {
final RegexRegisteredService service = new RegexRegisteredService();
service.setId(Math.abs(new SecureRandom().nextLong()));
service.setEvaluationOrder(0);
service.setName(service.getClass().getSimpleName());
service.setDescription("OAuth Authentication Callback Request URL");
service.setServiceId(oAuthCallbackUrl);
service.setAttributeReleasePolicy(new DenyAllAttributeReleasePolicy());
servicesManager.save(service);
servicesManager.load();
}
}
Aggregations