Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
5352ec1c
Commit
5352ec1c
authored
Jul 23, 2020
by
Danilo Piazzalunga
Committed by
Stephane Nicoll
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support configuration of entityId for a SAML Relying Party
See gh-22258
parent
0bc5b20d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
1 deletion
+39
-1
Saml2RelyingPartyProperties.java
...configure/security/saml2/Saml2RelyingPartyProperties.java
+19
-0
Saml2RelyingPartyRegistrationConfiguration.java
...ity/saml2/Saml2RelyingPartyRegistrationConfiguration.java
+1
-0
Saml2RelyingPartyAutoConfigurationTests.java
...curity/saml2/Saml2RelyingPartyAutoConfigurationTests.java
+3
-1
Saml2RelyingPartyPropertiesTests.java
...gure/security/saml2/Saml2RelyingPartyPropertiesTests.java
+15
-0
application.yml
...saml2-service-provider/src/main/resources/application.yml
+1
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyProperties.java
View file @
5352ec1c
...
...
@@ -50,6 +50,17 @@ public class Saml2RelyingPartyProperties {
*/
public
static
class
Registration
{
/**
* Relying party's EntityID.
*
* This value may contain a number of placeholders. They are: baseUrl,
* registrationId, baseScheme, baseHost, and basePort.
*
* The default value is
* {baseUrl}/saml2/service-provider-metadata/{registrationId}.
*/
private
String
relyingPartyEntityId
=
"{baseUrl}/saml2/service-provider-metadata/{registrationId}"
;
private
final
Signing
signing
=
new
Signing
();
/**
...
...
@@ -57,6 +68,14 @@ public class Saml2RelyingPartyProperties {
*/
private
Identityprovider
identityprovider
=
new
Identityprovider
();
public
String
getRelyingPartyEntityId
()
{
return
this
.
relyingPartyEntityId
;
}
public
void
setRelyingPartyEntityId
(
String
entityId
)
{
this
.
relyingPartyEntityId
=
entityId
;
}
public
Signing
getSigning
()
{
return
this
.
signing
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyRegistrationConfiguration.java
View file @
5352ec1c
...
...
@@ -80,6 +80,7 @@ class Saml2RelyingPartyRegistrationConfiguration {
builder
.
assertingPartyDetails
((
details
)
->
details
.
verificationX509Credentials
((
credentials
)
->
properties
.
getIdentityprovider
().
getVerification
()
.
getCredentials
().
stream
().
map
(
this
::
asVerificationCredential
).
forEach
(
credentials:
:
add
)));
builder
.
entityId
(
properties
.
getRelyingPartyEntityId
());
return
builder
.
build
();
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyAutoConfigurationTests.java
View file @
5352ec1c
...
...
@@ -92,6 +92,7 @@ public class Saml2RelyingPartyAutoConfigurationTests {
assertThat
(
registration
.
getAssertingPartyDetails
().
getWantAuthnRequestsSigned
()).
isEqualTo
(
false
);
assertThat
(
registration
.
getSigningX509Credentials
()).
isNotNull
();
assertThat
(
registration
.
getAssertingPartyDetails
().
getVerificationX509Credentials
()).
isNotNull
();
assertThat
(
registration
.
getEntityId
()).
isEqualTo
(
"{baseUrl}/saml2/foo-entity-id"
);
});
}
...
...
@@ -149,7 +150,8 @@ public class Saml2RelyingPartyAutoConfigurationTests {
PREFIX
+
".foo.identityprovider.singlesignon.binding=post"
,
PREFIX
+
".foo.identityprovider.singlesignon.sign-request=false"
,
PREFIX
+
".foo.identityprovider.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php"
,
PREFIX
+
".foo.identityprovider.verification.credentials[0].certificate-location=classpath:saml/certificate-location"
};
PREFIX
+
".foo.identityprovider.verification.credentials[0].certificate-location=classpath:saml/certificate-location"
,
PREFIX
+
".foo.relying-party-entity-id={baseUrl}/saml2/foo-entity-id"
};
}
private
boolean
hasFilter
(
AssertableWebApplicationContext
context
,
Class
<?
extends
Filter
>
filter
)
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyPropertiesTests.java
View file @
5352ec1c
...
...
@@ -25,6 +25,7 @@ import org.springframework.boot.context.properties.bind.Bindable;
import
org.springframework.boot.context.properties.bind.Binder
;
import
org.springframework.boot.context.properties.source.ConfigurationPropertySource
;
import
org.springframework.boot.context.properties.source.MapConfigurationPropertySource
;
import
org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration
;
import
org.springframework.security.saml2.provider.service.registration.Saml2MessageBinding
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -87,6 +88,20 @@ class Saml2RelyingPartyPropertiesTests {
.
isSignRequest
()).
isEqualTo
(
true
);
}
@Test
void
customizeRelyingPartyEntityId
()
{
bind
(
"spring.security.saml2.relyingparty.registration.simplesamlphp.relying-party-entity-id"
,
"{baseUrl}/saml2/custom-entity-id"
);
assertThat
(
this
.
properties
.
getRegistration
().
get
(
"simplesamlphp"
).
getRelyingPartyEntityId
())
.
isEqualTo
(
"{baseUrl}/saml2/custom-entity-id"
);
}
@Test
void
customizeRelyingPartyEntityIdDefaultsToServiceProviderMetadata
()
{
assertThat
(
RelyingPartyRegistration
.
withRegistrationId
(
"id"
)).
extracting
(
"entityId"
)
.
isEqualTo
(
new
Saml2RelyingPartyProperties
.
Registration
().
getRelyingPartyEntityId
());
}
private
void
bind
(
String
name
,
String
value
)
{
bind
(
Collections
.
singletonMap
(
name
,
value
));
}
...
...
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-saml2-service-provider/src/main/resources/application.yml
View file @
5352ec1c
...
...
@@ -15,6 +15,7 @@ spring:
entity-id
:
simplesaml
singlesignon
:
url
:
https://simplesaml-for-spring-saml/SSOService.php
relying-party-entity-id
:
"
{baseUrl}/saml2/simple-relying-party"
okta
:
signing
:
credentials
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment