Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to #40
This integrates Artifact Binding support. I tried to make as few changes as possible. In my tests I was able to switch back and forth between post and artifact binding without issue.
I did have to write a different example client because Okta seems to always respond with a post binding response regardless of the request made. I didn't include my example in the commit because it involved having a working IdP setup and probably would be of limited use to others.
SP creation in it looks like the following:
sp := &saml2.SAMLServiceProvider{
IdentityProviderSSOURL: metadata.IDPSSODescriptor.SingleSignOnServices[0].Location,
IdentityProviderArtifactResolutionServiceURL: metadata.IDPSSODescriptor.ArtifactResolutionService.Location,
HTTPClient: client,
IdentityProviderIssuer: metadata.EntityID,
ServiceProviderIssuer: "http://example.com/saml/acs/example",
AssertionConsumerServiceURL: "http://localhost:8080/v1/_saml_callback",
SignAuthnRequests: true,
AudienceURI: "http://example.com/saml/acs/example",
IDPCertificateStore: &certStore,
SPKeyStore: keyStore,
RequestedBinding: saml2.BindingHttpArtifact,
}
IdentityProviderArtifactResolutionServiceURL, RequestedBinding, and HTTPClient are the new fields. None are required if clients want to stick with POST binding.
On an unrelated note, I had to change BuildAuthURL to call BuildAuthURLRedirect rather than BuildAuthURLFromDocument to get valid requests for my IdP.