Accessing CAS attributes from custom Shib 3 data connector

John Manaloto manalotoj at gmail.com
Mon Aug 24 18:39:20 EDT 2015


Hello all,


I am using shib-cas-authn3 to delegate authentication from shibboleth 3.1.1
to CAS and I would like to expose extended attributes from shibboleth above
and beyond the uid/person name attribute. I don’t know how to extract the
extended attributes that I have programmatically attached to the
HttpServletRequest as well as the [user] session from
AuthenticatedNameTranslator within shib-cas-authn3 (fork
https://github.com/manalotoj/shib-cas-authn3). Modified shib-cas-authn3:


*public* *void* doTranslation(*final* HttpServletRequest request, *final*
HttpServletResponse response,

...

        Map<String, Object> principalAttributes = assertion
.getPrincipal().getAttributes();

        logger.debug("principal attributes: {}", principalAttributes
.toString());



        // add all other *cas* attributes to the request

        *for* (Object o : principalAttributes.entrySet()) {

              @SuppressWarnings("unchecked")

              Map.Entry<String, Object> pair = (Map.Entry<String, Object>) o
;

            request.setAttribute(pair.getKey(), pair.getValue());

            request.getSession().setAttribute(pair.getKey(), pair
.getValue());

            logger.debug("Set the '{}' attribute with value '{}' in request
and session.", pair.getKey(), pair.getValue());

        }

    }


I have stubbed and configured everything outside of the actual retrieval of
the extended attributes from within a custom data connector (refer to
https://github.com/manalotoj/campuslogic-shib3/blob/master/campuslogic-dc/src/main/java/net/campuslogic/shibboleth/dataconnector/CampusLogicCasDataConnector.java);
everything works as expected.


How do I access either the userSession or the HttpServletRequest from my
custom data connector (extends AbstractDataConnector)? I have looked at all
BaseContext instances (made available through AttributeResolverContext
including getParent() and all of its context objects) and I can’t find
anything. I also tried to use a scripted attribute resolver configuration
but ran into a similar roadblock in that requestContext.userSession is not
available/implemented.



Thanks,

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20150824/28873c3c/attachment.html>


More information about the users mailing list