当前位置:网站首页>Authoring share | understanding saml2 protocol

Authoring share | understanding saml2 protocol

2022-06-11 17:19:00 Authing

SAML2 review

Security Assertion Markup Language ( English :Security Assertion Markup Language, abbreviation SAML, pronunciation sam-el) It's based on XML Open source standard data format , It exchanges authentication and authorization data between the parties , Especially between identity providers and service providers .SAML2.0 It can realize single sign on based on network and cross domain (SSO), In order to reduce the management overhead of distributing multiple authentication tokens to a user .

SAML The main body

stay SAML Agreement , It involves two subjects :

Service Provider service provider , abbreviation SP. What is a service provider ? for example : Alicloud console 、 Tencent cloud console 、AWS These are service providers .

Identity Provider Identity Provider IdP , abbreviation IdP. What is an identity provider ?Authing As an identity provider , The identity provider can provide SP Send identity assertion , The so-called identity assertion is made by Authing Issued by , Can identify someone Token, It's just , stay SAML Agreement , This Token The format is XML Formal . There are other identity providers , for example Okta、SSOCircle、Auth0, They can all ask SP Return the identity assertion .

The two subjects exchange information through the user's browser . On the way ,SP Can return redirection with parameters HTTP Respond to , Let the user send the information to IdP. and IdP Will return a form , There's also a section to submit the form immediately JS Code , So that users can send information to SP.

To sum up ,SP Provide services , Need to know the identity of the user , You need to go to IdP inquiry .IdP Know the identity of the user , When the user IdP Login successful ,IdP The identity of the user will be SAML In the form of assertion SP.SP trust IdP The identity assertion sent , In this way, the user is endowed with the ability to SP Relevant permissions of .

SAML Request

When the user's identity cannot be verified ,SP Will send to IdP send out SAML Request Information ( Send through the browser ), request IdP To identify users .

Launched by Alibaba cloud console once SAML Request It's in the form of :

GET https://core.authing.cn/v2/api/saml-idp/5e10927e4ecfd464fb4edaf6?SAMLRequest=fZJLT%2BMwFIX3%2FIrI%2B7yct9Wk6kyFQGJERQKL2RnnJnWV2Blfp2L%2BPaGlDLOApaV7vnN0jlfrl3FwjmBQalWS0AuIA0roVqq%2BJI%2FNtZuTdXW1Qj4OdGKb2e7VA%2FyZAa2zQQRjF91PrXAewdRgjlLA48NdSfbWTsh8H2WvpPL4IP%2FOyhN69N9Qfl3fE2e7UKTi9mR9EQhtwOOLz5LAE8o%2FUp9P8qRyZTv5CYRBQTOIQXRtnMbdcwwt71LiXGsj4JSwJB0fEIhzuy0Jp9AXgvaHgwzzPA%2FjfXagbRYlebeP%2BmI5wh1HlEf4J0Oc4Vah5cqWhAY0cIPCpXkTRiwoWJJ5eZH%2BJs7OaKuFHn5IdS5sNoppjhKZ4iMgs4LVm193jHoBez4fIbtpmp27u68b4jxdiqdvxS9TKGTnqr9nTe%2FGpDovw06JzWfC9wB%2B2Y5UXy8VRlmcpkWUpUlGY5p8TLfyP7tW78%2F%2Fv0f1Cg%3D%3D

( Tips : The code can slide to the right )

SAMLRequest Parameters through query stay URL Send to IdP,SAMLRequest Is as follows :

fZJLT+MwFIX3/IrI+7yct9Wk6kyFQGJERQKL2RnnJnWV2Blfp2L+PaGlDLOApaV7vnN0jlfrl3FwjmBQalWS0AuIA0roVqq+JI/NtZuTdXW1Qj4OdGKb2e7VA/yZAa2zQQRjF91PrXAewdRgjlLA48NdSfbWTsh8H2WvpPL4IP/OyhN69N9Qfl3fE2e7UKTi9mR9EQhtwOOLz5LAE8o/Up9P8qRyZTv5CYRBQTOIQXRtnMbdcwwt71LiXGsj4JSwJB0fEIhzuy0Jp9AXgvaHgwzzPA/jfXagbRYlebeP+mI5wh1HlEf4J0Oc4Vah5cqWhAY0cIPCpXkTRiwoWJJ5eZH+Js7OaKuFHn5IdS5sNoppjhKZ4iMgs4LVm193jHoBez4fIbtpmp27u68b4jxdiqdvxS9TKGTnqr9nTe/GpDovw06JzWfC9wB+2Y5UXy8VRlmcpkWUpUlGY5p8TLfyP7tW78//v0f1Cg==

( Tips : The code can slide to the right )

base64 decode + inflate After decoding
(https://www.samltool.com/decode.php)

<?xml version="1.0" encoding="UTF-8"?>
<saml2p:AuthnRequest AssertionConsumerServiceURL="https://signin.aliyun.com/saml/SSO" Destination="https://core.authing.cn/v2/api/saml-idp/5e10927e4ecfd464fb4edaf6" ForceAuthn="false" ID="a2eg9c2gjji188814h7j2d7358fh3g9" IsPassive="false" IssueInstant="2020-09-28T13:09:57.896Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Version="2.0"
 xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol">
 <saml2:Issuer
  xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">https://signin.aliyun.com/1374669376572425/saml/SSO
 </saml2:Issuer>
</saml2p:AuthnRequest>

( Tips : The code can slide to the right )

SAML Response

IdP received SAML Request after , The login box will pop up to authenticate the user's identity :
 Insert picture description here

When the user IdP After logging in ,SAML IdP Send the user identity assertion to SP( Put in form , Through the browser POST Request to send ).SAML IdP The response is as follows :

<form id="saml-form" method="post" action="https://signin.aliyun.com/saml/SSO" autocomplete="off">
  <input
    type="hidden"
    name="SAMLResponse"
    id="saml-response"
    value="PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIElEPSJfNjJiMTc3YzEtYTkxOS00MmY2LTk1ODYtNDdmMTNiNzEwODFmIiBWZXJzaW9uPSIyLjAiIElzc3VlSW5zdGFudD0iMjAyMC0wOS0yOFQxMzozMDozMS43ODhaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9zaWduaW4uYWxpeXVuLmNvbS9zYW1sL1NTTyIgSW5SZXNwb25zZVRvPSJhNDlmOGVkaTMxY2owYTJhNDU5ZzAzMzFjM2Q5YzEwIj4KICA8c2FtbDpJc3N1ZXI+aHR0cHM6Ly8yMG5xdWx2b3FwYnAuYXV0aGluZy5jbjwvc2FtbDpJc3N1ZXI+CiAgPHNhbWxwOlN0YXR1cz4KICAgIDxzYW1scDpTdGF0dXNDb2RlIFZhbHVlPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6c3RhdHVzOlN1Y2Nlc3MiLz4KICA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pvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphdHRybmFtZS1mb3JtYXQ6YmFzaWMiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnR5cGU9InhzOnN0cmluZyI+bnVsbDwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PC9zYW1sOkFzc2VydGlvbj4KPC9zYW1scDpSZXNwb25zZT4="
  />
  <input
    type="hidden"
    name="RelayState"
    id="relay-state"
    value=""
  />
</form>
<script type="text/javascript">
  (function() {
    document.forms[0].submit();
  })();
</script>
( Tips : The code can slide to the right )

There is no mystery , It's just one. HTML form Form and a paragraph to submit the form immediately JS Code . Among them SAML Response The information is as follows :

base64 decode + inflate After decoding

(https://www.samltool.com/decode.php)

<samlp:Response
 xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
 xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_62b177c1-a919-42f6-9586-47f13b71081f" Version="2.0" IssueInstant="2020-09-28T13:30:31.788Z" Destination="https://signin.aliyun.com/saml/SSO" InResponseTo="a49f8edi31cj0a2a459g0331c3d9c10">
 <saml:Issuer>https://20nqulvoqpbp.authing.cn</saml:Issuer>
 <samlp:Status>
  <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
 </samlp:Status>
 <saml:Assertion
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_fae95b47-cbf3-4a20-add0-99d856b4124e" Version="2.0" IssueInstant="2020-09-28T13:30:31.788Z">
  <saml:Issuer>https://20nqulvoqpbp.authing.cn</saml:Issuer>
  <ds:Signature
   xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
   <ds:SignedInfo>
    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
    <ds:Reference URI="#_fae95b47-cbf3-4a20-add0-99d856b4124e">
     <ds:Transforms>
      <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
      <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
     </ds:Transforms>
     <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
     <ds:DigestValue>/ol6lC1j+smdonl48+lJTzUeqnw=</ds:DigestValue>
    </ds:Reference>
   </ds:SignedInfo>
   <ds:SignatureValue>awzcE0dp8BzTW4b4PFaRX7NKOC95bLqOnPeAKI/CsDfGaJdmzCK0fVliz+e6XzBluKfBpQtrQonKl7k2vVNaPFx9PpSVzwK91HLGvYQ0qB36uA4HFvm/3M31DL3ZRFPRq68ZaVAG6lMVd0YbiInVv9FWwsi+6jEpF+PRlmkoqAI=</ds:SignatureValue>
   <ds:KeyInfo>
    <ds:X509Data>
     <ds:X509Certificate>MIICQjCCAaugAwIBAgIBADANBgkqhkiG9w0BAQ0FADA+MQswCQYDVQQGEwJ1czESMBAGA1UECAwJ5LqL5a6e5LiKMQwwCgYDVQQKDANzc3MxDTALBgNVBAMMBHNzc3MwHhcNMjAwMTAzMTMxODE0WhcNMjEwMTAyMTMxODE0WjA+MQswCQYDVQQGEwJ1czESMBAGA1UECAwJ5LqL5a6e5LiKMQwwCgYDVQQKDANzc3MxDTALBgNVBAMMBHNzc3MwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMNWlMk4L+TcWwyd9plTPLhHL/UMCPGJgv5Vp8vaAp4WMsGtwOLI1UNWccIqMeU0KasJqrKxHYvq9JzZh4fftFmowBz36vz0eIUsP5PKvFULkC1vjrdn+QJXbJ51alZZKfPgl1HI8w6lh12aWTjaKQ+KemIttqLqJgLWOYAXPIszAgMBAAGjUDBOMB0GA1UdDgQWBBTT104hVYVnPpg7aFrDiXPShbtxUTAfBgNVHSMEGDAWgBTT104hVYVnPpg7aFrDiXPShbtxUTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBDQUAA4GBAB6+1xK7GMJa5M6Ujg/wd4Etwy8NdTF6ypSqN36Bd5OdPmwU9HzDuGjKi3ZwooPIGRB8piLsKk11M4IhAF4C2R/JsvVYwWOYgojW4H1hR5wk2jn7pltWqRPdfZBl0YfsDysUP7k8/MchOWX7WifNxpe3GdSKN17CkdRjL924bV0l</ds:X509Certificate>
    </ds:X509Data>
   </ds:KeyInfo>
  </ds:Signature>
  <saml:Subject>
   <saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">[email protected]</saml:NameID>
   <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
    <saml:SubjectConfirmationData NotOnOrAfter="2020-09-28T14:30:31.788Z" Recipient="https://signin.aliyun.com/saml/SSO" InResponseTo="a49f8edi31cj0a2a459g0331c3d9c10"/>
   </saml:SubjectConfirmation>
  </saml:Subject>
  <saml:Conditions NotBefore="2020-09-28T13:30:31.788Z" NotOnOrAfter="2020-09-28T14:30:31.788Z">
   <saml:AudienceRestriction>
    <saml:Audience>https://signin.aliyun.com/1374669376572425/saml/SSO</saml:Audience>
   </saml:AudienceRestriction>
  </saml:Conditions>
  <saml:AuthnStatement AuthnInstant="2020-09-28T13:30:31.888Z" SessionIndex="ooeumcq6eHjddr1H3Fyzou7Cs-OGTsNl">
   <saml:AuthnContext>
    <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef>
   </saml:AuthnContext>
  </saml:AuthnStatement>
  <saml:AttributeStatement>
   <saml:Attribute Name="email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
    <saml:AttributeValue
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">[email protected]
    </saml:AttributeValue>
   </saml:Attribute>
   <saml:Attribute Name="name" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
    <saml:AttributeValue
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"/>
    </saml:Attribute>
    <saml:Attribute Name="username" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
     <saml:AttributeValue
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">[email protected]
     </saml:AttributeValue>
    </saml:Attribute>
    <saml:Attribute Name="phone" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
     <saml:AttributeValue
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">null
     </saml:AttributeValue>
    </saml:Attribute>
   </saml:AttributeStatement>
  </saml:Assertion>
 </samlp:Response>

( Tips : The code can slide to the right )

This is the user's identity assertion , That's the user's Token, It's just this Token adopt XML Format transfer .

Read here , You may be right SP、IdP How to deal with these lengthy XML Confused by information .Authing Will solve these tedious processing , And you just need to focus on how to configure it properly Authing IdP, And SAML SP communicate .

SAML2 technological process

This article tells the readers about SAML in ,SP、IdP、 The process of data interaction between the three entities of the browser .

SAML The subject involved in the agreement

Use SAML Protocol for authentication , There are three subjects involved

  • browser :SP and IdP Communicate with each other through a browser
  • SP: Resource provider
  • IdP: Authentication providers

launch SAML Login to the whole process of successful login

 Insert picture description here

  1. The user tried to log in SP Applications provided .
  2. SP Generate SAML Request, Redirect through browser , towards IdP send out SAML Request.
  3. IdP analysis SAML Request And redirect the user to the authentication page .
  4. The user completes the login on the authentication page .
  5. IdP Generate SAML Response, By redirecting the browser , towards SP Of ACS The address to return SAML Response, It includes
  6. SAML Assertion Used to identify users .
  7. SP Yes SAML Response To test the contents of .
  8. The user successfully logged in to SP Applications provided .

SP And IdP How to communicate with each other

SP And IdP There are two ways of communication HTTP Redirect Binding、HTTP POST Binding、HTTP Artifact Binding. Each method uses different types of... At different stages HTTP Communicate with each other .

HTTP Redirect Binding

SP By redirecting GET Ask for SAML Request Send to IdP,IdP By submitting immediately Form Form to POST The way the request will be SAML Response Send to SP.

 Insert picture description here

HTTP POST Binding

IdP By submitting immediately Form Form to POST The way the request will be SAML Request Send to SP.IdP By submitting immediately Form Form to POST The way the request will be SAML Response Send to SP.

 Insert picture description here

HTTP Artifact Binding

SP、IdP Both sides only exchange through browser SAML Request、SAML Response The index number of , After receiving the number , Request the other party's Artifact Resolution Service Interface to get the real request entity content . To avoid SAML Request、SAML Response Exposed at the front .

 Insert picture description here


If you like our content , Welcome to the official account 「Authing Identity cloud 」 And visit our blog Authing Blog , More interesting content waiting for you to see ~

原网站

版权声明
本文为[Authing]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111709084580.html