首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在AngularJS应用程序中访问Shibboleth属性

如何在AngularJS应用程序中访问Shibboleth属性
EN

Stack Overflow用户
提问于 2018-06-20 16:31:59
回答 3查看 2.7K关注 0票数 3

我对SSO和Shibboleth都是新手。

我已经在Apache服务器上成功地实现了Shibboleth SP。每当用户试图访问受保护的资源时,用户都会根据IDP进行身份验证。

基本上,Shibboleth SSO有以下6个步骤:

  1. 用户访问受保护资源
  2. SP确定IdP并发出身份验证请求
  3. 用户对IdP进行身份验证
  4. IdP问题对SP的响应
  5. 回到SP
  6. 回到受保护的资源

我的客户端应用程序纯粹是使用AngularJS 1.6开发的。

直到第六步,一切都很顺利。我的问题是:

步骤6中的:如何在我的AngularJS客户端应用程序中访问Shibboleth属性(例如名字或姓氏)?或者可以在AngularJS应用程序中直接访问这些属性吗?

Shibboleth没有提到使用AngularJS访问属性。

请。任何帮助,指导,建议,建议,反馈,我们将非常感激。

更新

httpd.conf

我的httpd.conf非常简单。我为Shibboleth做的唯一额外配置如下所示。Rest一切都是默认的。

代码语言:javascript
复制
LoadModule mod_shib /usr/lib64/shibboleth/mod_shib_24.so

ServerName 10.63.32.125

<Location /licweb>
  AuthType shibboleth
  Require valid-user
  ShibRequireSession On
  ShibUseHeaders On
</Location>

shibboleth2.xml

这也是一个非常简单的文件。

代码语言:javascript
复制
<SPConfig xmlns="urn:mace:shibboleth:2.0:native:sp:config" 
    xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" clockSkew="180">
    <ApplicationDefaults entityID="https://www.example.com/licweb/shibboleth" REMOTE_USER="eppn persistent-id targeted-id">

        <Sessions lifetime="28800" timeout="3600" checkAddress="false" relayState="ss:mem" handlerSSL="false">
            <SSO entityID="https://my-sso-url">
                SAML2 SAML1
            </SSO>
            <Logout>SAML2 Local</Logout>

            <md:ArtifactResolutionService Location="/Artifact/SOAP" index="1" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
            <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
            <Handler type="Status" Location="/Status" acl="127.0.0.1"/>
            <Handler type="Session" Location="/Session" showAttributeValues="true" />
        </Sessions>
        <Errors supportContact="ankit.prajapati@yahoo.com" logoLocation="/shibboleth-sp/logo.jpg" styleSheet="/shibboleth-sp/main.css"/>
        <MetadataProvider type="XML" file="MetaData.xml"/>
        <AttributeExtractor type="XML" validate="true" path="attribute-map.xml"/>
        <AttributeResolver type="Query" subjectMatch="true"/>
        <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>
        <CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>
    </ApplicationDefaults>
    <SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>
    <ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>
</SPConfig>

会话

我还在URL:http://10.63.32.125/Shibboleth.sso/Session上获得了会话

代码语言:javascript
复制
Miscellaneous
Session Expiration (barring inactivity): 473 minute(s)
Client Address: 10.63.32.125
SSO Protocol: urn:oasis:names:tc:SAML:2.0:protocol
Identity Provider: https://my-identity-provider
Authentication Time: 2018-06-21T19:19:16.937Z
Authentication Context Class: urn:oasis:names:tc:SAML:2.0:ac:classes:AuthenticatedTelephony
Authentication Context Decl: (none)

Attributes
displayName: Doe,John
givenName: John
mail: john.doe@yahoo.com
persistent-id: https://my-persistent-id
sn: doe

我想在运行在URL:http://10.63.32.125/licweb上的http://10.63.32.125/licweb客户端网站上访问这个属性

任何帮助都将不胜感激。谢谢。

EN

回答 3

Stack Overflow用户

发布于 2018-06-22 05:08:10

我认为您不能直接访问角js中的属性。您可能需要一些服务器端支持(在java使用servlet的情况下)来读取属性。

有关信息,请参阅相关的thread

票数 2
EN

Stack Overflow用户

发布于 2019-10-03 12:25:46

通过在Session Handler中将contentType设置为application/json,您将得到一个JSON对象,而不是位于/Shibboleth.sso/Session/Shibboleth.sso/Session。您可以像其他任何JavaScript资源/ REST应用程序一样,在客户端JSON应用程序中请求这个请求。

代码语言:javascript
复制
<Handler type="Session" Location="/Session" showAttributeValues="true" contentType="application/json" />

请参阅https://wiki.shibboleth.net/confluence/display/SP3/Session+Handler

票数 2
EN

Stack Overflow用户

发布于 2018-06-21 17:50:56

当响应从IdP返回时,属性位于标头内。要访问它们,您必须启用受保护位置上的shibboleth标头:

代码语言:javascript
复制
<Location /SECUREPATH >
    AuthType shibboleth
    ShibRequireSession On
    ShibUseHeaders On
    Require valid-user
</Location>

您将能够通过javascript中的头访问这些参数。但是欺骗可能会发生https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSpoofChecking

这就是我们访问头部的方式。我们使用Shibboleth作为自己的apache服务器:

  • 用户访问/secure路径
  • 重定向到IdP
  • IdP返回到安全路径,这是可以看到的。Apache将/secure重定向到我们的web服务器,在那里我们有一个回调,并通过url访问属性。但我们加密这个网址是为了确保它来自我们。我还把ShibUseHeaders脱了

如何访问apache中的客户头:how to access custom header value in apache?

如何加密属性:Multiple values RewriteMap prg

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50953083

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档