本文介绍了通过Struts-1获取Shibboleth属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Shibboleth身份验证与旧的Struts-1应用程序集成在一起,而我已经继承了该应用程序的维护,但是我无法弄清楚该如何继承Shibboleth属性.

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.

这是我尝试过的:

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

在遍历上面代码中的属性名称时,没有打印出我期望的Shibboleth属性.

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?

推荐答案

事实证明,在我的情况下,这是服务器端配置的问题.

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

按照此处的说明进行操作后: https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPJavaInstall ,我能够简单地通过以下方式获取属性:

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

这篇关于通过Struts-1获取Shibboleth属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-25 00:29