Nguyen,
I configured cas properties for attributes (since the admins are under a different tree, than the authentication tree) and the role is in the description attribute:
cas.authn.attributeRepository.ldap[2].id=administrators
cas.authn.attributeRepository.ldap[2].order=2
cas.authn.attributeRepository.ldap[2].attributes.uvicEduPersonYubiKeyID=uvicEduPersonYubiKeyID
cas.authn.attributeRepository.ldap[2].attributes.eduPersonEntitlement=eduPersonEntitlement
cas.authn.attributeRepository.ldap[2].attributes.description=description
cas.authn.attributeRepository.ldap[2].connectTimeout=PT3S
cas.authn.attributeRepository.ldap[2].baseDn=ou=administrators,ou=CAS,ou=applications,dc=uvic,dc=ca
cas.authn.attributeRepository.ldap[2].subtreeSearch=true
cas.authn.attributeRepository.ldap[2].searchFilter=uid={user}
cas.authn.attributeRepository.ldap[2].bindDn=cn=Auth Manager,ou=CAS,ou=UVON,ou=administrators,dc=uvic,dc=ca
cas.authn.attributeRepository.ldap[2].bindCredential=
I then modified the service definition to return a mapped attribute (description -> roles):
{
"@class": "org.apereo.cas.services.RegexRegisteredService",
"name": "Services Management Web Application on local",
"id": 50,
"description": "Services Management Web Application on developer workstation",
"expirationPolicy":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceExpirationPolicy",
"deleteWhenExpired": false,
"notifyWhenDeleted": false,
"notifyWhenExpired": false
},
"proxyPolicy":
{
"@class": "org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy"
},
"proxyTicketExpirationPolicy":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceProxyTicketExpirationPolicy",
"numberOfUses": 0
},
"serviceTicketExpirationPolicy":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceServiceTicketExpirationPolicy",
"numberOfUses": 0
},
"evaluationOrder": 0,
"usernameAttributeProvider":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider",
"canonicalizationMode": "NONE",
"encryptUsername": false
},
"logoutType": "BACK_CHANNEL",
"requiredHandlers":
[
"java.util.HashSet",[]
],
"environments":
[
"java.util.HashSet",[]
],
"attributeReleasePolicy":
{
"@class": "org.apereo.cas.services.ReturnMappedAttributeReleasePolicy",
"allowedAttributes":
{
"@class": "java.util.TreeMap",
"description":
[
"java.util.ArrayList",
[
"roles"
]
]
},
"principalAttributesRepository":
{
"@class": "org.apereo.cas.authentication.principal.DefaultPrincipalAttributesRepository",
"mergingStrategy": "MULTIVALUED",
"ignoreResolvedAttributes": false
},
"consentPolicy":
{
"@class": "org.apereo.cas.services.consent.DefaultRegisteredServiceConsentPolicy",
"enabled": true,
"order": 0
},
"authorizedToReleaseCredentialPassword": false,
"authorizedToReleaseProxyGrantingTicket": false,
"excludeDefaultAttributes": false,
"authorizedToReleaseAuthenticationAttributes": true,
"order": 0
},
"multifactorPolicy":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy",
"multifactorAuthenticationProviders":
[
"java.util.HashSet",[]
],
"failureMode": "CLOSED",
"bypassEnabled": false,
"forceExecution": false,
"bypassTrustedDeviceEnabled": false
},
"accessStrategy":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy",
"order": 0,
"enabled": true,
"ssoEnabled": true,
"delegatedAuthenticationPolicy":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceDelegatedAuthenticationPolicy",
"allowedProviders":
[
"java.util.ArrayList",[]
],
"permitUndefined": true,
"exclusive": false
},
"requireAllAttributes": true,
"requiredAttributes":
{
"@class": "java.util.LinkedHashMap",
"description":
[
"java.util.HashSet",
[
"ADMIN"
]
]
},
"rejectedAttributes":
{
"@class": "java.util.LinkedHashMap"
},
"caseInsensitive": false
},
"properties":
{
"@class": "java.util.LinkedHashMap",
"test":
{
"@class": "org.apereo.cas.services.DefaultRegisteredServiceProperty",
"values":
[
"java.util.HashSet",
[
"FALSE"
]
]
}
},
"contacts":
[
"java.util.ArrayList",[]
]
}
I am going to edit our ldap data today to change from ADMIN to ROLE_ADMIN. (I got the attribute release working on Friday.)
You can see the attributes in cas management with this logging
<AsyncLogger name="org.pac4j.cas.client" level="trace" />
<AsyncLogger name="org.pac4j.cas.credentials" level="trace" />
and release in cas with
<!-- DEBUG Found principal attributes [...] for [username]
Attribute policy [???] allows release of [...] for [username]
Final collection of attributes allowed are: [...] -->
<AsyncLogger name="org.apereo.cas.services.AbstractRegisteredServiceAttributeReleasePolicy" level="debug"/>
Ray