- Clone the Spring Authorization Server repo.
- Start the authorization service only (follow their docs).
- Run the following:
CLIENT_ID=messaging-client CLIENT_SECRET=secret ISSUER_URI=http://auth-server:9000 ./gradlew bootRun
- Open http://127.0.0.1:8080 in a browser.
- Log in with
user1
andpassword
, and you should see a page sayingHello Auth!
.
- Configure a GitLab application and configure it with the following:
Callback URL: http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc Confidential: Yes Scopes: openid (Authenticate using OpenID Connect)
- Run the following, replacing the placeholders accordingly:
CLIENT_ID=<client_id> CLIENT_SECRET=<client_secret> ISSUER_URI=<gitlab_root_url> ./gradlew bootRun
- Open http://127.0.0.1:8080 in a browser.
- Log in with your GitLab credentials, and you should see a page saying
Hello Auth!
(you might need to authorize scopes first).
- Start KeyCloak in Docker :
docker run -p 9090:8080 --rm -it -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin jboss/keycloak
- Open http://localhost:9090/auth/admin in a browser.
- Log in with
admin
andadmin
. - Create a client named
messaging-client
. - Set
Access Type
toconfidential
. - Add
http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc
toValid Redirect URIs
. - Create a user named
user1
. - Set that user's password to
password
(and uncheckTemporary
). - Run the following, replacing the placeholders accordingly:
CLIENT_ID=messaging-client CLIENT_SECRET=<client_secret> ISSUER_URI=http://localhost:9090/auth/realms/master ./gradlew bootRun
- Open http://127.0.0.1:8080 in a browser.
- Log in with
user1
andpassword
, and you should see a page sayingHello Auth!
.