Git Product home page Git Product logo

keycloak-google-sso's Introduction

SSO using Keycloak and Spring Boot

I will use Google credentials to perform SSO and redirect to keycloak for authentication. I will use Keycloak auth token for authentication and authorization in my spring boot microservice.

Create a new realm in Keycloak

Login with admin and create new realm. img.png

Create a new client in Keycloak

  1. Provide client id, name etc.
  2. Set Client authentication on.
  3. Provide Valid redirect URI http://localhost:8081/login/oauth2/code/mono-client img_1.png
  4. Copy client id and secret and update in application.properties.

Create new Role

  1. Go to the Realm Roles and crate a new role as admin.

Create a new OAuth 2.0 Client ID in Google Cloud Console

  1. Check below screenshot and create a new client.
  2. Copy client id and secret. img_2.png

Identity Provider Settings

  1. Set the identity provider as Google.
  2. Put the copied id and secret in previous step.
  3. Go to Mapper and create a new mapper.
  4. Select Mapper type as Hardcoded role.
  5. Map the role "admin".

Run the application

Access http://localhost:8081/demo You will be redirected to Keycloak login page. Choose Google and login with your google account.

img_3.png

Access the application

You will be redirected to your application and you can see keycloak token in cookie.

img_4.png

keycloak-google-sso's People

Contributors

monobikashdas avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.