gosaml2 icon indicating copy to clipboard operation
gosaml2 copied to clipboard

How do i generate SP MetaData File Using gosaml2

Open vijay8059 opened this issue 3 years ago • 1 comments

Hi, how do i generate the service provider metadata file that needs to be shared with the IDP

Is there is way that i can generate below meta data file using gosaml2 that needs to share with the IDP

<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" validUntil="2021-07-27T11:19:13.559Z" entityID="http://localhost:8001/saml/metadata"> <SPSSODescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" validUntil="2021-07-27T11:19:13.55852Z" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" AuthnRequestsSigned="false" WantAssertionsSigned="true"> <KeyDescriptor use="encryption"> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <X509Data> <X509Certificate>MIICvDCCAaQCCQCujMRKGshPODANBgkqhkiG9w0BAQsFADAgMR4wHAYDVQQDDBVteXNlcnZpY2UuZXhhbXBsZS5jb20wHhcNMjEwNzI1MTExODExWhcNMjIwNzI1MTExODExWjAgMR4wHAYDVQQDDBVteXNlcnZpY2UuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDruv/Q6k4TZFnG/vDd060iuRviN2yM0J92nXNn2g3c/g3oqiB9eom/1mRUKOeHOhOFjC18m/nOeNss6RXjkWezIuhzYNKP0ABfhCT1pdVOTI8uBag9aXFPYsyRt+mV6qrJ6pNTzYkWpub0dfMuY1XDkW46Zp6YvAf/UVyfGTq0ZkX0WjrrZJOjaYcWajJ73xm5ZZuoX4KTQmbx7ctVkHsKk9SXFnSkaj1iEdqyg2pwGiG89FGhX731O178V5duLzUAh1bLyEKZKAkofpDWQptrdbP9ztbvVYHKj3dtqnYLjQadfMiX3EDV4RKo86CKbFC7NSy/H0gOtkkYhL9R/VtHAgMBAAEwDQYJKoZIhvcNAQELBQADggEBABw9BVBsJpcGGf7W9i+xaFsebb798TomoD2k5vNqJFi3ShpUAsqR4Zc1I9M4lPUPxFBBE+tpD1cVS6QQIfY62ql7ycd50Ma3CejkCW9DuOQ56X6hFIZl6TeZ0vv7T37m3F+URt7SXflRcn8VEQ1UidEc9VOD/E/1zgBkeniXkBXKgh5MYmUMfTF+flacNl1lBVFiibaD32aaVC97EqfdItcnlKvh7fYGiPAWFRoRrcJfKM1nurAt4kNEdpd/QncGQ2etUbkq3tBLczCRUdFKq1YYAmXVnZUZC6PM4+k/IPzR7xEdjZk1FEFNHTwOXLyxo3ZDlHmMcTvWlT93D7DXaqY=</X509Certificate> </X509Data> </KeyInfo> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"></EncryptionMethod> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes192-cbc"></EncryptionMethod> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"></EncryptionMethod> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"></EncryptionMethod> </KeyDescriptor> <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8001/saml/slo" ResponseLocation="http://localhost:8001/saml/slo"></SingleLogoutService> <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8001/saml/acs" index="1"></AssertionConsumerService> </SPSSODescriptor> </EntityDescriptor>

vijay8059 avatar Jul 26 '21 16:07 vijay8059

Initialize *saml2.SAMLServiceProvider and then call the .Metadata() method. This returns an entity descriptor you can call xml.Marshal.

Check out similar issue: https://github.com/russellhaering/gosaml2/issues/51

mfridman avatar Sep 26 '21 02:09 mfridman