use of org.apereo.cas.services.ReturnAllAttributeReleasePolicy in project cas by apereo.
the class OAuth20AccessTokenControllerTests method getRegisteredService.
private static OAuthRegisteredService getRegisteredService(final String serviceId, final String secret) {
final OAuthRegisteredService registeredServiceImpl = new OAuthRegisteredService();
registeredServiceImpl.setName("The registered service name");
registeredServiceImpl.setServiceId(serviceId);
registeredServiceImpl.setClientId(CLIENT_ID);
registeredServiceImpl.setClientSecret(secret);
registeredServiceImpl.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
return registeredServiceImpl;
}
use of org.apereo.cas.services.ReturnAllAttributeReleasePolicy 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.ReturnAllAttributeReleasePolicy in project cas by apereo.
the class LdapServiceRegistryDaoTests method verifySamlService.
@Test
public void verifySamlService() {
final SamlRegisteredService r = new SamlRegisteredService();
r.setName("verifySamlService");
r.setServiceId("Testing");
r.setDescription("description");
r.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
final Map fmt = new HashMap();
fmt.put("key", "value");
r.setAttributeNameFormats(fmt);
r.setMetadataCriteriaDirection("INCLUDE");
r.setMetadataCriteriaRemoveEmptyEntitiesDescriptors(true);
r.setMetadataSignatureLocation("location");
r.setRequiredAuthenticationContextClass("Testing");
final SamlRegisteredService r2 = (SamlRegisteredService) this.dao.save(r);
assertEquals(r, r2);
}
use of org.apereo.cas.services.ReturnAllAttributeReleasePolicy in project cas by apereo.
the class LdapServiceRegistryDaoTests method verifyOAuthServices.
@Test
public void verifyOAuthServices() {
final OAuthRegisteredService r = new OAuthRegisteredService();
r.setName("test1456");
r.setServiceId("testId");
r.setTheme("theme");
r.setDescription("description");
r.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
r.setClientId("testoauthservice");
r.setClientSecret("anothertest");
r.setBypassApprovalPrompt(true);
final RegisteredService r2 = this.dao.save(r);
assertEquals(r, r2);
}
use of org.apereo.cas.services.ReturnAllAttributeReleasePolicy in project cas by apereo.
the class BaseLdapServiceRegistryTests method verifyOAuthServices.
@Test
public void verifyOAuthServices() {
final OAuthRegisteredService r = new OAuthRegisteredService();
r.setName("test1456");
r.setServiceId("testId");
r.setTheme("theme");
r.setDescription("description");
r.setAttributeReleasePolicy(new ReturnAllAttributeReleasePolicy());
r.setClientId("testoauthservice");
r.setClientSecret("anothertest");
r.setBypassApprovalPrompt(true);
final RegisteredService r2 = this.dao.save(r);
assertEquals(r, r2);
}
Aggregations