-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Configure SAML 2.0 Service Provider via Metadata #23045
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
Conversation
The build appears to be failing due to something unrelated:
and
Is there something I should do to address the build failures? |
Thanks for asking @jzheaux. We had some CI issues recently, we will take care of that as part of reviewing the PR. |
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.
Thanks for the PR. I've made a few comments, would you have time to review?
/** | ||
* Endpoint for discovery-based configuration. | ||
*/ | ||
private String metadataUrl; |
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.
Would that make sense to move that to a metadata
sub-namespace the way we do for singlesignon
and verification
. Not sure if this could be extended in the future though.
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 know of a use case where there would be more to specify or configure regarding the identity provider's metadata. I'd recommend it stay at this level. In most cases, an application would either specify metadata-url
or the rest of the properties.
That said, it occurs to me that there's metadata-based configuration support for OAuth 2.0 where the property is named issuer-uri
. It may be better to call this metadata-uri
.
@@ -28,6 +28,7 @@ | |||
import org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyProperties.Identityprovider.Verification; | |||
import org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyProperties.Registration; | |||
import org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyProperties.Registration.Signing; | |||
import org.springframework.boot.context.properties.PropertyMapper; |
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.
The use of PropertyMapper
adds a lot of noise to what this PR actually changes. I'd prefer if we did that separately (if at all).
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.
If we leave the associated code as-is, then nulls will override what was specified through the metadata endpoint.
Would surrounding each of those lines with if statements be preferrable?
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.
Sorry I missed that. PropertyMapper it is then!
@@ -55,6 +58,15 @@ | |||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner().withConfiguration( | |||
AutoConfigurations.of(Saml2RelyingPartyAutoConfiguration.class, SecurityAutoConfiguration.class)); | |||
|
|||
private MockWebServer server; |
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.
There is only one test that uses this. An argument could be made that we could make this local to that test only.
@@ -176,6 +201,46 @@ private boolean hasFilter(AssertableWebApplicationContext context, Class<? exten | |||
return filters.stream().anyMatch(filter::isInstance); | |||
} | |||
|
|||
private void setupMockResponse() { | |||
String metadataResponse = "<md:EntityDescriptor entityID=\"https://idp.example.com/idp/shibboleth\"\n" |
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.
Move this XML file to a test resource perhaps?
thanks for the follow-up @jzheaux! |
Closes gh-22986