Skip to content

Add Tests for findSamlRealm #35905

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

Merged
merged 2 commits into from
Nov 27, 2018
Merged

Conversation

jkakavas
Copy link
Member

@jkakavas jkakavas commented Nov 26, 2018

No description provided.

This commit allows Elasticsearch to match and handle correctly
`SamlPrepareAuthenticationRequest`s that contain only the realm name
of the SAML realm or `SamlPrepareAuthenticationRequest`s that contain
both the realm name and the acsURL but the acsURL doesn't match the
configured one in the SAML realm configuration.

This allows for easier configuration of Kibana and also solves issues
like elastic/kibana#22954. It also allows
easier configuration of custom web apps talking to Elasticsearch as
the realm name is anecdotally easier to copy-paste/keep in sync/alter

Since we only allow the configuration of a single ACS URL, there is
effectively a 1-1 mapping between SAML realm and ACS URL and any of
the two should be sufficient to match the realm. However, since in
Kibana, the realm name will be an explicit setting and the ACS URL
is a constructed and implicit one, we fail the
`SamlPrepareAuthenticationRequest` when the realm is defined but not
matching.
@jkakavas jkakavas added >enhancement v7.0.0 :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v6.6.0 labels Nov 26, 2018
@jkakavas jkakavas requested a review from tvernum November 26, 2018 12:15
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security

@tvernum
Copy link
Contributor

tvernum commented Nov 26, 2018

I think this is a bad idea.
I'll review properly tomorrow, but if Kibana has a realm name, then it shouldn't send an ACS. There's no reason for ES to ignore what is sent, just don't send it.

@jkakavas
Copy link
Member Author

Thanks for the quick feedback Tim. I'll leave the findSamlRealms as is so that if a request contains an ACS URL, it also needs to match.
I'll rephrase the PR as adding a test.

@jkakavas jkakavas changed the title Allow SamlPrepareAuthenticate only with realm name Add Tests for findSamlRealm Nov 26, 2018
@tvernum
Copy link
Contributor

tvernum commented Nov 27, 2018

Thanks @jkakavas. Sorry if my response was too direct, it was late and I wanted to get something to you before I went to bed.

Copy link
Contributor

@tvernum tvernum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jkakavas jkakavas merged commit 998c663 into elastic:master Nov 27, 2018
jkakavas added a commit that referenced this pull request Nov 27, 2018
This commit adds a test for handling correctly all they possible
`SamlPrepareAuthenticationRequest` parameter combinations that
we might get from Kibana or a custom web application talking to the
SAML APIs.
We can match the correct SAML realm based either on the realm name
or the ACS URL. If both are included in the request then both need to
match the realm configuration.
@jkakavas jkakavas deleted the saml-get-by-realm branch November 27, 2018 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants