Pergunta

I'm trying to integrate Shibboleth authentication with an old Struts-1 application that I've inherited the maintenance of, but I cannot figure out how to acecss the Shibboleth attributes.

This is what I have tried:

public final class AuthenticateAction extends MappingDispatchAction {

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {


        Enumeration attributeNames = request.getAttributeNames();
        while (attributeNames.hasMoreElements()) {
            String attributeNm = (String) attributeNames.nextElement();
            System.out.println("DEBUG: " + attributeNm);
        }

        String eppn = (String) request.getAttribute("eppn"); // <-- Null 

None of the Shibboleth attributes that I expect are printed out while looping through the attribute names in the code above.

How do I access the Shibboleth attributes?

Foi útil?

Solução

Turns out that in my case, it was an issue with the server-side config.

After following the instructions here: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall, I was able to get the attributes simply as:

String eppn = (String) request.getAttribute("eppn"); // <-- no longer null

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top