简体   繁体   English

JAVA中的SAML请求和响应

[英]SAML request and response in JAVA

First let me tell you what my situation is 首先让我告诉你我的情况
I have 3 service Providers and 1 Identity Provider. 我有3个服务提供商1个身份提供商。 (ie i am the service provider as well as identity provider). (即我是服务提供商以及身份提供商)。 I want to implement SSO using SAML. 我想使用SAML实现SSO。
I am writing the SAML request in the following way 我正在以下列方式编写SAML请求

 <samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="identifier_1"
Version="2.0"
IssueInstant="2004-12-05T09:21:59Z"
AssertionConsumerServiceIndex="0">
<saml:Issuer>https://sp.example.com/SAML2</saml:Issuer>
<samlp:NameIDPolicy
  AllowCreate="true"
  Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"/>


I am able to send the request properly. 我能够正确发送请求。 I dont understand how the response should be. 我不明白应该如何回应。 There are many attributes in response code like Digest,Certificate,etc..,. 响应代码中有许多属性,如摘要,证书等。 What are they? 这些是什么?

Is there any rule that I should follow only SAML protocol. 是否有任何规则我应该只遵循SAML协议。 Can I create my own protocol, Since I am the Service as well as Identity Provider? 我可以创建自己的协议,因为我既是服务又是身份提供商?

Below is an extract from the SAML V2.0 Technical Overview . 以下是SAML V2.0技术概述的摘录。 The document is really a thing worth to look at. 该文件真的值得一看。 Following it you have to define your business use case, choose a profile for this use case, and implement a protocol complying with this profile. 在此之后,您必须定义业务用例,为此用例选择一个配置文件,并实现符合此配置文件的协议。 If profile doesn't exist - you can define your own protocol. 如果配置文件不存在 - 您可以定义自己的协议。 The request and response attributes will depend on the profile. 请求和响应属性将取决于配置文件。

SAML consists of building-block components that, when put together, allow a number of use cases to be supported. SAML由构建块组件组成,当它们放在一起时,允许支持许多用例。 The components primarily permit transfer of identity, uthentication, attribute, and authorization information between autonomous organizations that have an established trust relationship. 这些组件主要允许在具有已建立信任关系的自治组织之间传输身份,身份验证,属性和授权信息。

The core SAML specification defines the structure and content of both assertions and protocol messages used to transfer this information. 核心SAML规范定义了用于传输此信息的断言和协议消息的结构和内容。

SAML assertions carry statements about a principal that an asserting party claims to be true. SAML断言带有关于主体声称是真实的委托人的陈述。 The valid structure and contents of an assertion are defined by the SAML assertion XML schema. 断言的有效结构和内容由SAML断言XML模式定义。 Assertions are usually created by an asserting party based on a request of some sort from a relying party, although under certain circumstances, the assertions can be delivered to a relying party in an unsolicited manner. 断言通常由断言方基于来自依赖方的某种请求创建,尽管在某些情况下,断言可以以未经请求的方式传递给依赖方。 SAML protocol messages are used to make the SAML-defined requests and return appropriate responses. SAML协议消息用于生成SAML定义的请求并返回适当的响应。 The structure and contents of these messages are defined by the SAML-defined protocol XML schema. 这些消息的结构和内容由SAML定义的协议XML模式定义。

The means by which lower-level communication or messaging protocols (such as HTTP or SOAP) are used to transport SAML protocol messages between participants is defined by the SAML bindings. 下层通信或消息传递协议(如HTTP或SOAP)用于在参与者之间传输SAML协议消息的方法由SAML绑定定义。

Next, SAML profiles are defined to satisfy a particular business use case, for example the Web Browser SSO profile. 接下来,定义SAML配置文件以满足特定业务用例,例如Web浏览器SSO配置文件。 Profiles typically define constraints on the contents of SAML assertions, protocols, and bindings in order to solve the business use case in an interoperable fashion. 配置文件通常定义对SAML断言,协议和绑定的内容的约束,以便以可互操作的方式解决业务用例。 There are also Attribute Profiles, which do not refer to any protocol messages and bindings, that define how to exchange attribute information using assertions in ways that align with a number of common usage environments (eg X.500/ LDAP directories, DCE). 还有属性配置文件,它们不引用任何协议消息和绑定,它们定义如何使用断言以与多种常见使用环境(例如X.500 / LDAP目录,DCE)对齐的方式交换属性信息。

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

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