GithubHelp home page GithubHelp logo

keycloak-grails's Introduction

keycloak

Demo for configuring Keycloak auth with grails rest app and react based frontend

Prerequisite

  • Key-cloack 4.8.3.Final server installed
  • Node/Npm
  • Java (1.8)
  • Grails 3.3.9
  • Gradle

Setup

1: Start keycloak (should be on 8180 port, [else need to modify keyclock.json in backend as well as frontend project])

  1. Import realm-import.json as realm import in keyclock

  2. Start the grails application: cd blog-demo

You must need to modifies 2 properties inside blog-demo/grails-app/conf/application.yml under keycloak node current values are:

admin: admin

password: admin

Set admin value is the value of your administration login of keyclock also password value is the value of your administration password of keyclock

we need it to perform bootstraps users from grails app

Now run app :

grails run-app

  1. Start the react application

go to frontend dir

npm install

npm start

  1. Go to localhost:3000 and login using user/pass which are mentioned below.

login users:

username password group
user password users-group
user2 password users-group
admin password admins-group

groups:

users-group -> can only see post

admins-group -> can see post and add post

  • open localhost:3000
  • It will redirect you to keyclock, once you login from above credentials you will see react Ui where 2 tabs will appears
  • 1st one is User and 2nd one is Admin
  • if login user is part of users-group and it will try to add blog using admin tab, when user will submit blog from model then its will get 401 (un authentication notification), admin tab is visible for users-group to demonstrate resource authentication(As users-group users will not have access for create blog resource)
  • if you will login through user which is part of admins-group, can see the list of post and can add the post using admin tab

keycloak-grails's People

Contributors

vsadh-jft avatar

Stargazers

Dharmesh avatar

Watchers

James Cloos avatar  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.