Further debugging:

PersonDirectoryPrincipalResolver.java

public Principal resolve(Credential credential, Principal currentPrincipal, 
AuthenticationHandler handler) {   

And now this code gets really confusing:

Principal currentPrincipal nicely holds all the attributes that I previously 
setted when created HandlerResult:

return createHandlerResult(credential, 
this.principalFactory.createPrincipal(((UsernamePasswordCredential) 
credential).getPersonalCode(), attributeMap), list); 

But for some reason currentPrincipal and attributes setted there, are 
ignored and thrown away ...


Only principalID is transformed to new PrincipalID.



On Thursday, September 14, 2017 at 10:45:50 AM UTC+3, Priit Serk wrote:
>
> CAS 5
>
> Handler:
>
> @Override
> protected HandlerResult doAuthentication(Credential credential) throws 
> GeneralSecurityException, PreventedException {
>    final Map<String, Object> attributeMap = 
> fillAttributes((UsernamePasswordCredential) credential);
>
>    attributeMap.put("name", "Test attribute value");
>          final List<MessageDescriptor> list = new ArrayList<>();
>    return createHandlerResult(credential,
>          this.principalFactory.createPrincipal(((UsernamePasswordCredential) 
> credential).getPersonalCode(),
>                attributeMap),
>          list);
>
>
> Service:
>
> "scopes": [
>    "java.util.HashSet", [ "openid",  "profile" ]
>    
> ],
> "attributeReleasePolicy": {
>    "@class": "org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy",
>    "allowedAttributes" : [ "java.util.ArrayList", [ "name" ] ]
> }
>
>
>
> OAuth20UserProfileControllerController (profile request):
>
>    accessToken.getAuthentication().getPrincipal();
>
>    principal.getAttributes()
>
> Principal = instanceOf SimplePrincipal, but previously added attribute is not 
> there. 
>
> Trying to debug through the code to understand how it actually works, but no 
> luck till now.
>
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/f7d6fcea-1ae5-46e8-94b9-a257aae6f861%40apereo.org.

Reply via email to