-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Stated Docker dependencies - Updated u/p information
- Loading branch information
Showing
3 changed files
with
113 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,37 @@ module which is new in Spring Security 5.2. | |
|
||
The https://docs.spring.io/spring-security/reference/servlet/saml2/logout.html[SAML 2.0 Logout feature] is new in Spring Security 5.6. | ||
|
||
== Run the Sample | ||
|
||
=== Install Docker | ||
|
||
This sample requires Docker to run a local IdP. | ||
As an alternative, you can point the sample at your own IdP by changing the `application.yml` here: | ||
|
||
[source,java] | ||
---- | ||
saml2: | ||
ap.metadata: {your-idp-metadata-endpoint} | ||
---- | ||
|
||
=== Start up the Sample Boot Application | ||
``` | ||
./gradlew :servlet:spring-boot:java:saml2:refreshable-metadata:bootRun | ||
``` | ||
|
||
=== Open a Browser | ||
|
||
http://localhost:8080/ | ||
|
||
You will be redirected to the SimpleSAMLPHP instance. | ||
|
||
=== Type in your credentials | ||
|
||
``` | ||
User: user1 | ||
Password: user1pass | ||
``` | ||
|
||
== Goals | ||
|
||
=== SAML 2.0 Login | ||
|
@@ -32,27 +63,7 @@ You can refer to the https://docs.spring.io/spring-security/reference/servlet/sa | |
=== Refreshable Asserting Party Metadata | ||
|
||
The application uses a custom implementation of `RelyingPartyRegistrationRepository` to achieve Asserting Party Metadata refresh feature. | ||
This particular implementation uses a `@Scheduled` annotation to update its metadata every 30 minutes. | ||
|
||
== Run the Sample | ||
|
||
=== Start up the Sample Boot Application | ||
``` | ||
./gradlew :servlet:spring-boot:java:saml2:refreshable-metadata:bootRun | ||
``` | ||
|
||
=== Open a Browser | ||
|
||
http://localhost:8080/ | ||
|
||
You will be redirect to the Okta SAML 2.0 IDP | ||
|
||
=== Type in your credentials | ||
|
||
``` | ||
User: [email protected] | ||
Password: 12345678 | ||
``` | ||
This particular implementation relies on an OpenSAML component that refreshes the metadata. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,45 @@ This code uses `RelyingPartyRegistrations#collectionFromMetadata` to demonstrate | |
|
||
See the https://github.com/spring-projects/spring-security/wiki/SAML-2.0-Migration-Guide[SAML 2.0 Migration Guide] for more details about the migration. | ||
|
||
== Run the Sample | ||
|
||
=== Install Docker | ||
|
||
This sample requires Docker to run a local IdP. | ||
As an alternative, you can point the sample at your own IdP by changing the `application.yml` here: | ||
|
||
[source,java] | ||
---- | ||
spring: | ||
security: | ||
saml2: | ||
relyingparty: | ||
registration: | ||
one: | ||
assertingparty.metadata-uri: {your-idp-metadata-endpoint} | ||
// ... | ||
two: | ||
assertingparty.metadata-uri: {your-idp-metadata-endpoint} | ||
---- | ||
|
||
=== Start up the Sample Boot Application | ||
``` | ||
./gradlew :servlet:spring-boot:java:saml2:saml-extension-federation:bootRun | ||
``` | ||
|
||
=== Open a Browser | ||
|
||
http://localhost:8080/ | ||
|
||
You will be redirected to the SimpleSAMLPHP instance. | ||
|
||
=== Type in your credentials | ||
|
||
``` | ||
User: user1 | ||
Password: user1pass | ||
``` | ||
|
||
== Key Changes | ||
|
||
=== URL Forwarding Filter | ||
|
@@ -51,48 +90,8 @@ public class SamlExtensionUrlForwardingFilter extends OncePerRequestFilter { | |
} | ||
---- | ||
|
||
=== application.yml | ||
|
||
[source%linenums,yml] | ||
---- | ||
spring: | ||
security: | ||
filter: | ||
dispatcher-types: async, error, request, forward <1> | ||
saml2: | ||
relyingparty: | ||
registration: | ||
one: | ||
singlelogout: | ||
binding: POST | ||
url: "{baseUrl}/saml/logout" <2> | ||
responseUrl: "{baseUrl}/saml/SingleLogout" <3> | ||
acs: | ||
location: "{baseUrl}/saml/SSO" <4> | ||
assertingparty.metadata-uri: https://dev-05937739.okta.com/app/exk598vc9bHhwoTXM5d7/sso/saml/metadata | ||
---- | ||
|
||
==== `RelyingPartyRegistration` properties | ||
=== `RelyingPartyMetadata` configuration component | ||
|
||
The `RelyingPartyRegistration` properties should also be customized to match the values that were used by the SAML Extension (see <2>, <3> and <4> above). | ||
The `RelyingPartyRegistration` properties are customized to match the values that were used by the SAML Extension. | ||
|
||
== Run the Sample | ||
|
||
=== Start up the Sample Boot Application | ||
``` | ||
./gradlew :servlet:spring-boot:java:saml2:saml-extension-federation:bootRun | ||
``` | ||
|
||
=== Open a Browser | ||
|
||
http://localhost:8080/ | ||
|
||
Select the first IdP listed. | ||
You will be redirect to the Okta SAML 2.0 IDP | ||
|
||
=== Type in your credentials | ||
|
||
``` | ||
User: [email protected] | ||
Password: 12345678 | ||
``` | ||
These reside in `RelyingPartyMetadata`. |