apache - 如何为 SAML2 生成有效的 SP XML 文件?

标签 apache saml-2.0 adfs shibboleth

我不知道为我的自定义 SP 服务实现 SAML2 协议(protocol),并且我遇到了一些困难...

我已经尝试过了;

<?xml version="1.0" encoding="UTF-8"?>
 <EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://www.mydomain.ext/#/secure">
  <SPSSODescriptor WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
   <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://www.mydomain.ext/#/" isDefault="true"/>
    <KeyDescriptor>
     <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      <ds:X509Data>
       <ds:X509Certificate>
        {my_x509_certificate_generated}
       </ds:X509Certificate>
      </ds:X509Data>
     </ds:KeyInfo>
    </KeyDescriptor>
   <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:entity</NameIDFormat>
  </SPSSODescriptor>
 </EntityDescriptor>

我需要将 xml 文件发送到 IDP。制作有效的 SP xml 文件有什么遗漏吗?谢谢

最佳答案

您附加的 XML 是 SP 元数据,它描述 SP 属性 - ID、证书、绑定(bind)支持等... 我建议您在开始实际编码或配置之前先熟悉 SAML。

这里有一些很好的资源:

https://github.com/jch/saml

https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language

https://en.wikipedia.org/wiki/SAML_2.0

如果您使用 JAVA 实现 SP,这里有一些您可以使用的好库: OneLogin 的 SAML Java 工具包 - https://github.com/onelogin/java-saml

Okta 登录小部件 - https://github.com/okta/okta-signin-widget

适用于 Java 的 LastPass SAML SDK - https://github.com/lastpass/saml-sdk-java

极其简单的 SAML 2.0 客户端 - https://github.com/coveo/saml-client

pac4j - http://www.pac4j.org/docs/clients/saml.html

关于apache - 如何为 SAML2 生成有效的 SP XML 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46099042/

相关文章:

java - 单点登录框架

asp.net - 如何从本地 ADFS 声明中获取用户组

apache httpd 替代品不起作用

spring - Keycloak 和 Spring SAML : SigAlg was null

apache - 服务器设置 : Based on Apache and Tomcat needs

saml-2.0 - 获取 Okta 中与用户关联的组列表

asp.net - OWIN - 签署和加密请求

azure - 使用 Azure AD 验证签名

php - 高 HTTP API 调用时 Apache 服务器变慢

ruby-on-rails - Rails 3 乘客路径错误