Spring Boot/Angular integrates Keycloak to achieve single sign-on
This paper introduces the basic knowledge of Keycloak, the configuration of ADFS and Salesforce IDP, and the method of integrating Spring Boot and Angular with Keycloak to realize single sign-on.
The code of this paper is based on the detailed explanation of Angular 8 integrated Spring Boot 2, and deletes the original JWT, user, permission, login and other codes. The Angular code uses keycloak-angular, which is slightly modified. GitHub source code address: heroes-api, heroes-web.
Software environment:
Keycloak 8.0.1
Spring Boot 2.2.2
Angular 8.2
ADFS 2016
Salesforce Cloud
Keycloak
Keycloak provides open source authentication and access management for modern applications and services, commonly known as authentication and authorization. Keycloak supports OpenID, OAuth 2.0 and SAML 2.0 protocols, user registration, user management, rights management, OTP, proxy OpenID, SAML 2.0 IDP, GitHub, LinkedIn and other third-party login, integration of LDAP and Active Directory;, custom authentication process, custom user interface, and internationalization.
Keycloak supports Java, C#, Python, Android, iOS, JavaScript, Nodejs and other platforms or languages, provides easy-to-use Adapter, and requires only a small amount of configuration and code to implement SSO.
Keycloak's new release, named Quarkus, is a Kurbernetes Native Java framework tailored for GraalVM and OpenJDK HotSpot and is scheduled to be officially released at the end of 2019.
Installation
Keycloak is built on WildFly application server. Download Standalone server distribution and decompress it from the official website and run bin/standalone.sh to start it. The H3 database is used by default, and you can modify the configuration to use other databases. See the official documentation for Standalone Clustered Mode, Domain Clustered Mode startup mode, and more configuration.
By default, the local URL is http://localhost:8080/auth, and you must create an admin user when you log in for the first time:
Log in to Admin Console http://localhost:8080/auth/admin/ directly: