Search in sources :

Example 6 with ReturnAllAttributeReleasePolicy

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;
}
Also used : ReturnAllAttributeReleasePolicy(org.apereo.cas.services.ReturnAllAttributeReleasePolicy) OAuthRegisteredService(org.apereo.cas.support.oauth.services.OAuthRegisteredService)

Example 7 with ReturnAllAttributeReleasePolicy

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());
        }
    }
}
Also used : RegisteredServiceAttributeReleasePolicyStrategyEditBean(org.apereo.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyStrategyEditBean) DenyAllAttributeReleasePolicy(org.apereo.cas.services.DenyAllAttributeReleasePolicy) ReturnAllAttributeReleasePolicy(org.apereo.cas.services.ReturnAllAttributeReleasePolicy) ScriptedRegisteredServiceAttributeReleasePolicy(org.apereo.cas.services.ScriptedRegisteredServiceAttributeReleasePolicy) AbstractRegisteredServiceAttributeReleasePolicy(org.apereo.cas.services.AbstractRegisteredServiceAttributeReleasePolicy) ReturnAllowedAttributeReleasePolicy(org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy) GroovyScriptAttributeReleasePolicy(org.apereo.cas.services.GroovyScriptAttributeReleasePolicy) ReturnMappedAttributeReleasePolicy(org.apereo.cas.services.ReturnMappedAttributeReleasePolicy) RegisteredServiceAttributeReleasePolicyEditBean(org.apereo.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyEditBean)

Example 8 with ReturnAllAttributeReleasePolicy

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);
}
Also used : ReturnAllAttributeReleasePolicy(org.apereo.cas.services.ReturnAllAttributeReleasePolicy) HashMap(java.util.HashMap) SamlRegisteredService(org.apereo.cas.support.saml.services.SamlRegisteredService) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 9 with ReturnAllAttributeReleasePolicy

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);
}
Also used : ReturnAllAttributeReleasePolicy(org.apereo.cas.services.ReturnAllAttributeReleasePolicy) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) AbstractRegisteredService(org.apereo.cas.services.AbstractRegisteredService) SamlRegisteredService(org.apereo.cas.support.saml.services.SamlRegisteredService) OAuthRegisteredService(org.apereo.cas.support.oauth.services.OAuthRegisteredService) RegisteredService(org.apereo.cas.services.RegisteredService) OAuthRegisteredService(org.apereo.cas.support.oauth.services.OAuthRegisteredService) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 10 with ReturnAllAttributeReleasePolicy

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);
}
Also used : ReturnAllAttributeReleasePolicy(org.apereo.cas.services.ReturnAllAttributeReleasePolicy) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) AbstractRegisteredService(org.apereo.cas.services.AbstractRegisteredService) SamlRegisteredService(org.apereo.cas.support.saml.services.SamlRegisteredService) OAuthRegisteredService(org.apereo.cas.support.oauth.services.OAuthRegisteredService) RegisteredService(org.apereo.cas.services.RegisteredService) OAuthRegisteredService(org.apereo.cas.support.oauth.services.OAuthRegisteredService) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ReturnAllAttributeReleasePolicy (org.apereo.cas.services.ReturnAllAttributeReleasePolicy)12 Test (org.junit.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 RegisteredService (org.apereo.cas.services.RegisteredService)4 ReturnAllowedAttributeReleasePolicy (org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy)4 OAuthRegisteredService (org.apereo.cas.support.oauth.services.OAuthRegisteredService)4 SamlRegisteredService (org.apereo.cas.support.saml.services.SamlRegisteredService)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 AbstractRegisteredService (org.apereo.cas.services.AbstractRegisteredService)3 AbstractRegisteredServiceAttributeReleasePolicy (org.apereo.cas.services.AbstractRegisteredServiceAttributeReleasePolicy)3 DefaultRegisteredServiceUsernameProvider (org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider)3 DenyAllAttributeReleasePolicy (org.apereo.cas.services.DenyAllAttributeReleasePolicy)3 GroovyScriptAttributeReleasePolicy (org.apereo.cas.services.GroovyScriptAttributeReleasePolicy)3 RegexRegisteredService (org.apereo.cas.services.RegexRegisteredService)3 ReturnMappedAttributeReleasePolicy (org.apereo.cas.services.ReturnMappedAttributeReleasePolicy)3 ScriptedRegisteredServiceAttributeReleasePolicy (org.apereo.cas.services.ScriptedRegisteredServiceAttributeReleasePolicy)3 RegisteredServiceAttributeReleasePolicyEditBean (org.apereo.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyEditBean)2 RegisteredServiceAttributeReleasePolicyStrategyEditBean (org.apereo.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyStrategyEditBean)2 DefaultRegisteredServiceAccessStrategy (org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy)2