问题描述
我了解默认情况下,配置的属性将存储为环境变量,并且可以像
I understand that configured attributes will be stored as environment variables by default and will be accessible like
request.getAttribute("Shib-Identity-Provider")
我尝试了一下,经过一番谷歌搜索后,我了解到可以访问它们
I tried that and after some googling I understood that to access them in Java through AJP.
我需要为此前缀
<ApplicationDefaults id="default" policyId="default"
entityID="https://idp.example.org"
REMOTE_USER="eppn persistent-id targeted-id"
signing="false" encryption="false" attributePrefix="AJP_">
我做到了,但我的Java应用程序中仍然保持空值
I did that but I still keep getting null in my Java application
- Shib-Identity-Provider-空
- Shib-Session-ID-空
- Shib-Application-ID-空
有人可以帮我弄清楚我要使它工作的什么吗?
Could someone help me figure out what I am missing to make it work?
推荐答案
-
确保属性映射文件中包含此字段。
Make sure you have this field in you attribute map file.
1.1并且idP也必须发送属性。
1.1 And idP has to send the attribute too.
由于属性前缀为 AJP_,因此属性将以 AJP_attributeName(这也可以有所不同)
Since you have attribute prefix as "AJP_" your attributes will be coming as "AJP_attributeName" (This can vary too)
2.1您必须打开通常在8009上侦听的AJP端口,然后将/ secure路径重定向到AJP。
2.1 You have to open up your AJP port which usually listens on 8009 and redirect the /secure path to AJP. You have to do this in apache to forward proxy as AJP.
2.2在您的/ secure路径的servlet /处理程序中,尝试获取属性为 request。 getHeader( AJP_attrName)
。
2.2 In your servlet/handler of /secure path try getting attribute as request.getHeader("AJP_attrName")
.
(如果这不起作用,也可以尝试以下方法。a。 reqest.getAttribute( attr)
b。 reqest.getAttribute( AJP_attr)
c。 header.getAttribute( attr)
c。 header.getAttribute( AJP_attr)
。我告诉你尝试一下,因为我很早以前就已经这样做了,我不确定确切的方法。)
(Can try following too if this does not work a. reqest.getAttribute("attr")
b. reqest.getAttribute("AJP_attr")
c. header.getAttribute("attr")
c. header.getAttribute("AJP_attr")
. I am telling you to try out this because I have done this long time ago and I am not sure about exact method.)
这篇关于Shibboleth SP-从Java读取断言属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!