Access principal name from servlet filter

Cantor, Scott cantor.2 at osu.edu
Thu Aug 20 12:33:32 EDT 2015


On 8/20/15, 11:25 AM, "dev on behalf of Etienne Dysli-Metref" <dev-bounces at shibboleth.net on behalf of etienne.dysli-metref at switch.ch> wrote:

>I'm porting a servlet filter that was used with IdPv2 to v3 and it uses
>edu.internet2.middleware.shibboleth.idp.util.HttpServletHelper and
>edu.internet2.middleware.shibboleth.idp.authn.LoginContext to read the
>current principal name, like so:
>
>LoginContext loginContext = HttpServletHelper.getLoginContext(
>  HttpServletHelper.getStorageService(servletContext),
>  servletContext,
>  (HttpServletRequest) request);
>String principalName = loginContext.getPrincipalName();
>
>and then writes it into a cookie.
>What is the equivalent functionality in v3?

I don't recall what that actually means. The login context is normally what's used to track state during login, and so there wouldn't be a principal name by then. So I'm not sure.

Assuming this is an External login handler, the ExternalAuthentication interface contains a method to get the ProfileRequestContext, and that's the root of the tree containing everything the IdP knows about the request. But I'm not sure what the original field actually meant, so I'd have to look into that. If you know offhand...

-- Scott



More information about the dev mailing list