Access to authenticatedEntryAttributes from HandlerResult

52 views
Skip to first unread message

Daniel Spillers

unread,
Sep 26, 2016, 3:22:24 PM9/26/16
to cas-...@apereo.org
I've written my own Authentication Handler to do some extra things after authentication. I've overridden the authenticateUsernamePasswordInternal method and the first thing I do is run the authenticate method against the delegate:

@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential usernamePasswordCredential)
            throws GeneralSecurityException, PreventedException {

        /** Authenticate. */
        final HandlerResult result = this.delegate.authenticate(usernamePasswordCredential);


What I need to do is check some of the 
ldapEntry attributes that get populated after authentication (the delegate is an LdapAuthenticationHandler) in order to decide whether or not to do the "extra things". 

Do I have access to that information from within my authentication handler at this point, either from the delegate or the HandlerResult? Could anyone provide guidance, even guidance on what additional information I need to provide you? Thank you.

daniel spillers
University of Arkansas at Little Rock | Information Technology Services
501.916.3010 | ualr.edu/itservices

djspillers

unread,
Sep 26, 2016, 3:36:36 PM9/26/16
to CAS Community
I might have titled this topic "access to LdapEntry attributes (perhaps stored in principalAttributeMap?) instead of authenticatedEntryAttributes.

Misagh Moayyed

unread,
Sep 26, 2016, 3:57:52 PM9/26/16
to djspillers, CAS Community

Depending on what those “things” are, you can either look at the HandlerResult and peek into either the authentication object or the principal associated with it, and you’ll find the attributes.


-- 
Misagh
--
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 cas-user+u...@apereo.org.
To post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/080e9ebd-58d4-4b86-903e-c656247d1b5b%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.

Daniel Spillers

unread,
Sep 27, 2016, 10:28:42 AM9/27/16
to Misagh Moayyed, CAS Community
Excellent! Misagh, could you point me to any documentation that would guide me as to what methods or properties I would use on the HandlerResult to access the principal and its attributes?



daniel spillers
University of Arkansas at Little Rock | Information Technology Services
501.916.3010 | ualr.edu/itservices


On Mon, Sep 26, 2016 at 2:56 PM, Misagh Moayyed <mmoa...@unicon.net> wrote:

Depending on what those “things” are, you can either look at the HandlerResult and peek into either the authentication object or the principal associated with it, and you’ll find the attributes.


-- 
Misagh

From: djspillers <djspi...@ualr.edu>
Reply: djspillers <djspi...@ualr.edu>
Date: September 26, 2016 at 11:06:52 PM
To: CAS Community <cas-...@apereo.org>
Subject:  [cas-user] Re: Access to authenticatedEntryAttributes from HandlerResult
I might have titled this topic "access to LdapEntry attributes (perhaps stored in principalAttributeMap?) instead of authenticatedEntryAttributes.

On Monday, September 26, 2016 at 2:22:24 PM UTC-5, djspillers wrote:
I've written my own Authentication Handler to do some extra things after authentication. I've overridden the authenticateUsernamePasswordInternal method and the first thing I do is run the authenticate method against the delegate:

@Override
protected HandlerResult authenticateUsernamePasswordInternal(final UsernamePasswordCredential usernamePasswordCredential)
            throws GeneralSecurityException, PreventedException {

        /** Authenticate. */
        final HandlerResult result = this.delegate.authenticate(usernamePasswordCredential);


What I need to do is check some of the 
ldapEntry attributes that get populated after authentication (the delegate is an LdapAuthenticationHandler) in order to decide whether or not to do the "extra things". 

Do I have access to that information from within my authentication handler at this point, either from the delegate or the HandlerResult? Could anyone provide guidance, even guidance on what additional information I need to provide you? Thank you.

daniel spillers
University of Arkansas at Little Rock | Information Technology Services
501.916.3010 | ualr.edu/itservices

--
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 cas-user+unsubscribe@apereo.org.

Daniel Spillers

unread,
Sep 27, 2016, 10:36:10 AM9/27/16
to Misagh Moayyed, CAS Community
I may have found it. Would this be relevant?




daniel spillers
University of Arkansas at Little Rock | Information Technology Services
501.916.3010 | ualr.edu/itservices


To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.

Daniel Spillers

unread,
Sep 27, 2016, 10:44:08 AM9/27/16
to Misagh Moayyed, CAS Community
Yes! That did it. Thank you for the clue!

final HandlerResult result = this.delegate.authenticate(usernamePasswordCredential);

Map<String,Object> attributes = result.getPrincipal().getAttributes();

Easy peasy!



daniel spillers
University of Arkansas at Little Rock | Information Technology Services
501.916.3010 | ualr.edu/itservices


Reply all
Reply to author
Forward
0 new messages