vdenotaris/spring-boot-security-saml-sample
Fork: 351 Star: 564 (更新于 2024-11-06 05:14:21)
license: Apache-2.0
Language: Java .
SBS3 — A sample SAML 2.0 Service Provider built on Spring Boot.
最后发布版本: 2.4.0.RELEASE ( 2021-12-20 05:38:34)
[SBS3] Spring Boot Sample SAML 2.0 Service Provider
Project description
This project represents a sample implementation of a SAML 2.0 Service Provider, completely built on Spring Framework. In particular, it shows how to develop a web solution devised for Federated Authentication, by integrating Spring Boot and Spring Security SAML. The configuration has been completely defined using Java annotations (no XML).
SSOCircle (ssocircle.com) is used as public Identity Provider for test purpose.
- Author: Vincenzo De Notaris (dev@vdenotaris.com)
- Website: www.vdenotaris.com
-
Version:
2.4.0.RELEASE
- Last update: December 19th, 2021
Thanks to Vladimír Schäfer (github.com/vschafer) for supporting my work.
References
Spring Boot
Spring Boot makes it easy to create Spring-powered, production-grade applications and services with absolute minimum fuss. It takes an opinionated view of the Spring platform so that new and existing users can quickly get to the bits they need.
Spring Security SAML Extension
Spring SAML Extension allows seamless inclusion of SAML 2.0 Service Provider capabilities in Spring applications. All products supporting SAML 2.0 in Identity Provider mode (e.g. ADFS 2.0, Shibboleth, OpenAM/OpenSSO, Ping Federate, Okta) can be used to connect with Spring SAML Extension.
Changelog [new]
- Version
2.4.0.RELEASE
:- Update to Spring Boot
2.6.1
- Update to JUnit
5
- Update to Log4J
2.17.0
(see: CVE-2021-44228) - Update to Jackson
2.13.0
- Update to Apache Commons
4.4
- A circular reference exists between the beans
samlEntryPoint
andsamlIDPDiscovery
that depends on the original design of the core Spring SAML extension library.
- Update to Spring Boot
Walkthrough
Run as Docker container
To make it even easier, it is possible to run the project "as-is" also as Docker container. A valid account on SSOCircle is needed to perform the authentication process.
Run as container building a Docker image
Run a pre-built fat-jar:
docker run -it --rm -p 8080:8080 -t vdenotaris/spring-saml-sp:latest
or compile the code and run the application with Maven:
docker run -it --rm -p 8080:8080 -t vdenotaris/spring-saml-sp:2.4.0-mvn-jdk-8
Note: the related Docker image is publicly available on Docker Hub.
The Service Provider is deployed as web application. Enter http://localhost:8080/ in a browser to see the application running.
If you’re using Docker natively on Linux, Docker for Mac, or Docker for Windows, then the web app should now be listening on port 8080 on your Docker daemon host. Point your web browser to http://localhost:8080 to find the starting page. If this doesn’t resolve, you can also try http://127.0.0.1:8080/.
If you’re using Docker Machine on a Mac or Windows, use docker-machine ip MACHINE_VM
to get the IP address of your Docker host. Then, open http://MACHINE_VM_IP:8080 in a browser. However, please note that the Service Provider is statically registered with localhost as endpoint on SSOCircle. Thus you need to reconfigure the application.
Unit tests
I would like to say thank you to Alexey Syrtsev (github.com/airleks) for his contribution on unit tests.
Metric | Result |
---|---|
Coverage % | 99% |
Lines Covered | 196 |
Total Lines | 199 |
Additional notes
- The certificate on https://idp.ssocircle.com/ seems to change on a fairly regular basis. This results in the following exception.
javax.net.ssl.SSLPeerUnverifiedException: SSL peer failed hostname validation for name: null
To update the SSOCircle certificates within the keystore, just run:
cd src/main/resources/saml/ && sh ./update-certifcate.sh
-
Sometimes SSO Circle could display you an error during the authenticaton process. In this case, please update your federation metadata directly on https://idp.ssocircle.com:
Manage Metadata > Service Provider Metadata
Remove the current record and add a new one, using your FQDN and providing a new copy of your metadata: your can retrieve them at http://localhost:8080/saml/metadata.
-
When the project version corresponds with the Spring Boot parent version, Maven may give you a warning as follows:
Version is duplicate of parent version.
Actually there is nothing wrong with the used configuration, thus you can just ignore that message.
License
Copyright 2021 Vincenzo De Notaris
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
最近版本更新:(数据更新于 2024-09-22 09:21:59)
2021-12-20 05:38:34 2.4.0.RELEASE
2020-02-15 18:07:59 2.3.1.RELEASE
2020-02-12 20:49:04 2.3.0.RELEASE
2019-10-02 23:38:49 2.2.1.RELEASE
2019-09-30 02:10:25 2.2.0.RELEASE
2019-03-25 23:31:51 2.1.0.RELEASE
2019-03-04 01:08:24 2.0.1.RELEASE
2019-01-02 05:27:38 2.0.0.RELEASE
2019-01-02 05:20:37 2.0.0.RC
2017-10-22 00:07:58 1.8.0.RELEASE
主题(topics):
authentication, iam, identity, java, saml, spring, spring-boot, spring-security-saml, sso
vdenotaris/spring-boot-security-saml-sample同语言 Java最近更新仓库
2024-11-05 19:32:42 xiaojieonly/Ehviewer_CN_SXJ
2024-11-05 04:13:47 Stirling-Tools/Stirling-PDF
2024-11-04 02:03:13 exzhawk/EhViewer
2024-11-03 00:43:09 PBH-BTN/PeerBanHelper
2024-10-31 18:52:00 CodePhiliaX/Chat2DB
2024-10-31 11:19:43 mybatis-flex/mybatis-flex