简体   繁体   English

通过Struts-1获取Shibboleth属性

[英]Getting Shibboleth Attributes through Struts-1

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. 我试图将Shibboleth身份验证与旧的Struts-1应用程序集成在一起,但我已经继承了该应用程序的维护,但是我无法弄清楚如何使用Shibboleth属性。

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. 遍历上面代码中的属性名称时,我期望的Shibboleth属性都没有打印出来。

How do I access the Shibboleth attributes? 如何访问Shibboleth属性?

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: 在按照以下说明进行操作之后: https : //wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall ,我能够简单地以如下方式获取属性:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM