- https://hub.docker.com/r/bitnami/keycloak/
- Download docker_compose.yml:
curl -LO https://raw.githubusercontent.com/bitnami/bitnami-docker-keycloak/master/docker-compose.yml
- Modify docker_compose.yml: change "80:8080" to "8180:8080"
- Run
docker-compose up
- Keycloak console at: http://localhost:8010
- Login as default admin account
- user:bitnami
- Create realm: SpringBootKeycloak
- Redirect URL: http://localhost:8081/*
- Create role: user
- Create user: user1:ASDqwe123!@#
- Commandline
gradle bootRun
- Go to http://localhost:8081/posts.
- You will be redirected to Keycloak's login page.
- Login as user1
- You will redirected back and given access
- Go to http://localhost:8081/posts/admin.
- You will be redirected to Keycloak's login page.
- Login as user1 (which does not have the admin role)
- You will redirected to Forbidden (403) page
- Logout:
- Go to: http://localhost:8081/logout
- For non-GET requests, you need to get the access token via the Keycloak REST API:
- Go to: localhost:8180/realms/SpringBootKeycloak/protocol/openid-connect/token
- See this article on how to get the access token
- Issue:
"error": "RESTEASY003210: Could not find resource for full path: http://localhost:8180/auth/realms/SpringBootKeycloak/protocol/openid-connect/token"
- Issue:
error_description": "Account is not fully set up"
- Issue:
Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through field 'keycloakConfigResolver'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'securityConfig': Requested bean is currently in creation: Is there an unresolvable circular reference?
- Issue:
Failed to load URLs from http://localhost:8180/auth/realms/SpringBootKeycloak/.well-known/openid-configuration