How to generate saml 2.0 sso service metadata

Suhail Wani picture Suhail Wani · Jun 11, 2015 · Viewed 9.9k times · Source

We have created many SAML implementations in the past. Normally, the client would send us SAML XML data containing key info, user info, certificate , etc and we would parse the info, match key and certificates. And get user's unique identifier from the xml and then Authenticate the user based on whether he is present in our database or not and send logged in user to some page of our domain. (I have a secondary question to ask here: Does that make us Saml IdentityProvider or ServiceProvider).

Anyway, Now this one particular client is asking us to send them the SAML SSO Metadata files. They say that In order for them to deploy a federation from their environment into our environment they need a copy of our SAML SSO Service Metadata as specified here http://en.wikipedia.org/wiki/SAML_2.0#SSO_Service_Metadata

So what do i do? We have never has such a request before. We dont use any third party tools but have built a custom implementation of SAML using c# and Visual Studio. Please help.

Answer

Aravin picture Aravin · Jun 25, 2018

You can generate SAML IdP metadata from here: https://www.samltool.com/idp_metadata.php

You can generate SAML SP metadata form here: https://www.samltool.com/sp_metadata.php

Metadata is an simple xml file which describe your organization details such name, display name, technical contact details, public key for sigining, public key for encryption etc.

Here is the sample data from OneLogin SSO provider:

<?xml version="1.0"?>
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" entityID="https://app.onelogin.com/saml/metadata/703037">
  <IDPSSODescriptor xmlns:ds="http://www.w3.org/2000/09/xmldsig#" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
    <KeyDescriptor use="signing">
      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:X509Data>
          <ds:X509Certificate>MIIELDCCAxSgAwIBAgIUa0r3l1uIkdnRLn5tmlWFHhQ9b5IwDQYJKoZIhvcNAQEF
BQAwXzELMAkGA1UEBhMCVVMxFzAVBgNVBAoMDlRlc3QgT25lIExvZ2luMRUwEwYD
VQQLDAxPbmVMb2dpbiBJZFAxIDAeBgNVBAMMF09uZUxvZ2luIEFjY291bnQgMTE0
MTM0MB4XDTE3MDkxMzA3MjgzNVoXDTIyMDkxNDA3MjgzNVowXzELMAkGA1UEBhMC
VVMxFz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bbOpRbDpViCdsI2BbjW9xKQu2KEhX2J5aMYTr
qRdV0lH8BS57/sG0ewcAThg8CdCzi7tCOZtnihdhDT+EVKiiXpZueYJNWTpDDe7I
96e8+UD2AxCcW1YLw7vXMA==</ds:X509Certificate>
        </ds:X509Data>
      </ds:KeyInfo>
    </KeyDescriptor>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://dnb-dev.onelogin.com/trust/saml2/http-redirect/slo/703037"/>

      <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>

    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://dnb-dev.onelogin.com/trust/saml2/http-redirect/sso/703037"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://dnb-dev.onelogin.com/trust/saml2/http-post/sso/703037"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://dnb-dev.onelogin.com/trust/saml2/soap/sso/703037"/>
  </IDPSSODescriptor>
</EntityDescriptor>