-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Validate audience with entityIssuer if present, use redirectURI otherwise #896
Conversation
connector/saml/saml.go
Outdated
@@ -154,6 +154,11 @@ func (c *Config) openConnector(logger logrus.FieldLogger) (*provider, error) { | |||
return nil, fmt.Errorf("missing required fields %q", missing) | |||
} | |||
|
|||
// Set EntityIssuer to RedirectURI if it is not set | |||
if c.EntityIssuer == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to send this if EntityIssuer isn't explicitly set. Issuer is optional and since you stated this wasn't a safe assumption I think it's safer to avoid this default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, pushed new change
6993e63
to
334a7b3
Compare
@@ -466,21 +466,25 @@ func (p *provider) validateConditions(assertion *assertion) error { | |||
} | |||
} | |||
// Validates audience | |||
audienceValue := p.entityIssuer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me, but do you think it'd be better to make entityIssuer required? I'm a little on the fence, but it seems like this is important when verifying the audience restrictions.
Would like to know what sounds more reasonable to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'll be ok as long as we make it clear in the documentation. Let me add it.
334a7b3
to
47897f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Validate audience with entityIssuer if present, use redirectURI otherwise
Comparing with the spec, it appears that Audience values refer to EntityIssuer, and not RedirectURI (though in most cases they are the same, but not all).
This sets EntityIssuer to RedirectURI by default if it is not explicitly set, allowing implementations that need it to function correctly.
Spec: http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html
We see that EntityIssuer is
https://sp.example.com/SAML2
, but Destination ishttps://sp.example.com/SAML2/SSO/POST