-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SP Metadata generation #51
Comments
Hi @ekaterinasmarp, I was struggling with the same thing. After some tinkering, I think this would do it. sp := &saml2.SAMLServiceProvider{
IdentityProviderSSOURL: metadata.IDPSSODescriptor.SingleSignOnServices[0].Location,
IdentityProviderIssuer: metadata.EntityID,
ServiceProviderIssuer: "http://localhost:8080",
AssertionConsumerServiceURL: "http://localhost:8080/v1/_saml_callback",
SignAuthnRequests: true,
AudienceURI: "http://localhost:8080",
IDPCertificateStore: &certStore,
SPKeyStore: LoadKeyStore("myservice.cert", "myservice.key"),
}
meta, err := sp.Metadata()
xmlMeta, err := xml.Marshal(meta)
fmt.Println(string(xmlMeta[:])) |
Though, it seems some of the Metadata generated by this library is found to be invalid by https://samltest.id/ (the replacement for testshib.org). I'll see what can be done about that. |
I actually have it where you visit the link such as (https://domain.com/saml/metadata) it shows you the metadata xml. I tested on samltest.id and it works fine without any issues. However, I created the XML file manually using a struct. Note that I knew what my metadata file had to have based on the request response. |
@SeniorCluckers would you be able to share some sample code? Interested in how you're doing it. |
A little old but I had the same error on samltest. My fix: metadata, err := sp.Service.Metadata()
if err != nil {
return nil, err
}
// Workaround as the lib is currently marshalling to nanoseconds which cannot be used with samltest
metadata.ValidUntil = time.Now().Add(time.Hour * 24 * 7).Round(time.Millisecond)
return xml.MarshalIndent(metadata, "", " ") Maybe this helps somebody else with the same problem :) |
Hello, Is there any way I can get metadata XML string from the library? It is usually used in order to integrate with IdP and contains information like entity name, public key, assertion consumer endpoint etc.
The text was updated successfully, but these errors were encountered: