All Projects → jannie-louwrens → spring-boot-keycloak-angular

jannie-louwrens / spring-boot-keycloak-angular

Licence: other
Securing a Angular frontend and a Spring Boot backend with Keycloak and Spring Security

Programming Languages

typescript
32286 projects
java
68154 projects - #9 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to spring-boot-keycloak-angular

spring-boot-web-application-sample
Real World Spring Boot Web Application Example with tons of ready to use features
Stars: ✭ 143 (+257.5%)
Mutual labels:  keycloak, spring-security
keycloak-sso
custom account management template, keycloak authentication and authorization
Stars: ✭ 41 (+2.5%)
Mutual labels:  keycloak, spring-security
keycloak-springsecurity5-sample
Spring Security 5 OAuth2 Client/OIDC integration with Keycloak sample
Stars: ✭ 55 (+37.5%)
Mutual labels:  keycloak, spring-security
secure-oauth2-oidc-workshop
Hands-On Workshop for OAuth 2.0 and OpenID Connect 1.0
Stars: ✭ 58 (+45%)
Mutual labels:  keycloak, spring-security
springboot-keycloak-mongodb-testcontainers
Goals: 1) Create a Spring Boot application that manages books; 2) Use Keycloak as authentication and authorization server; 3) Test using Testcontainers; 4) Explore the utilities and annotations that Spring Boot provides when testing applications.
Stars: ✭ 18 (-55%)
Mutual labels:  keycloak
keycloak-docker
Docker image for Keycloak 6.0.1 (postgres, ssl) + k8s + Openshift
Stars: ✭ 19 (-52.5%)
Mutual labels:  keycloak
keyonic-v2
A Keycloak Mobile Implementation using Angular v4 and Ionic v3
Stars: ✭ 23 (-42.5%)
Mutual labels:  keycloak
panda
基于dorado 的spring-boot研发的开发框架
Stars: ✭ 16 (-60%)
Mutual labels:  spring-security
keycloak-restrict-client-auth
A Keycloak authenticator to restrict authorization on clients
Stars: ✭ 34 (-15%)
Mutual labels:  keycloak
keycloak-sms-authenticator-sns
SMS 2 Factor Authentication for Keycloak via AWS SNS
Stars: ✭ 66 (+65%)
Mutual labels:  keycloak
Keycloak.Net
C# client for Keycloak 6.x
Stars: ✭ 100 (+150%)
Mutual labels:  keycloak
gocloaksession
Maintains an active keycloak session using gocloak
Stars: ✭ 15 (-62.5%)
Mutual labels:  keycloak
Keycloak
Open Source Identity and Access Management For Modern Applications and Services
Stars: ✭ 10,826 (+26965%)
Mutual labels:  keycloak
brauzie
Awesome CLI for fetching JWT tokens for OAuth2.0 clients
Stars: ✭ 14 (-65%)
Mutual labels:  keycloak
Oauth2-Stateless-Authentication-with-Spring-and-JWT-Token
Oauth2 Stateless Authentication with Spring and JWT Token
Stars: ✭ 108 (+170%)
Mutual labels:  spring-security
react-keycloak-examples
Examples for react-keycloak packages
Stars: ✭ 110 (+175%)
Mutual labels:  keycloak
spring-boot-angular-maven-starter
An example of Spring Boot and Angular 6 integration with the help of Maven and Kotlin.
Stars: ✭ 13 (-67.5%)
Mutual labels:  spring-security
keycloak-mysql-user-federation
Keycloak user federation extension to connect to a MySQL database containing users
Stars: ✭ 17 (-57.5%)
Mutual labels:  keycloak
keycloak-mail-whitelisting
Keycloak extension to whitelist email adresses domain when users register
Stars: ✭ 36 (-10%)
Mutual labels:  keycloak
vagrant-codes-in-practice
Vagrant code files similar to the real bare metal environments
Stars: ✭ 22 (-45%)
Mutual labels:  keycloak

Grocery Shop

Grocery Shop

This is the source code for my article on how to securing a Angular frontend and a Spring Boot backend using Keycloak.

Orignal Requirements

  • Keycloak 4.6.0.Final
  • Java 8
  • Spring Boot 2.0.7.RELEASE
  • Angular 7.1.4
  • Node.js 10.15.0
  • Yarn 1.12.3

Updated Requirements (since blog post)

  • 10 Dec 2019
    • Keycloak 8.0.1.Final
    • Spring Boot 2.2.2.RELEASE
    • Angular 8.2.14
    • Node.js 12.13.1
    • Yarn 1.19.2
  • 1 Feb 2022
    • Angular 13.2.1
    • Node.js 16.13.2
    • Yarn 1.22.17
  • 23 Apr 2022
    • Angular 13.3.3
    • Node.js 16.14.2
    • Yarn 1.22.18

Installing and Configuring Keycloak

Download the standalone server distribution from the Keycloak website, unpack it and start the server. Follow the Getting Started instructions to setup the administrator account.

There are two ways to configure the Keycloak realm for this application:

  1. Import the demo-realm.json
  2. Follow the Create Realm, Client and Users guide

Create Realm, Client and Users

This section is only for those who wish to manually configure the Keycloak server.

1. Create a realm

Follow the create a realm instructions and create a realm called: demo

2. Create a client

Follow steps 1- 3 of the creating and registering guide and create a new client called: my-app

In the Valid Redirect URIs field enter the two URLs: http://localhost:8081/* and http://localhost:4200/*

Note the asterisk (*) after the urls!

And in the Web Origins fields simply add a * (asterisk)

3. Create roles and assign permissions

In the Keycloak administration console create two new roles, named: user and admin Edit the admin role and enable the Composite Roles flag and choose realm-management from the Client Roles droplist. Highlight the view-users option in the Available Roles block and then click on the "Add selected" button.

4. Create the following users:

Username Password First Name Last Name Email Roles
metalgear password Bob Knight [email protected] ADMIN, USER
grilldad password Jim Long [email protected] USER
mythbuster password Kate Wilson [email protected] USER
spacehunter password Victor Brown [email protected] USER

It is most important that you enter the username as provided in the table, because they are used in the Spring backend to link the customer orders with the user.

Start the Spring Boot Application

Open a terminal and change to the directory where the code was checked out. Next change to the backend directory and execure the following maven command:

mvn clean package spring-boot:run

Build and Run the Angular Frontend Application

Open another terminal and change to the directory where the code was checked out. Next change to the frontend directory abd execute the following commands:

yarn install
yarn start

View the Application

Open an internet browser and navigate to the url: http://localhost:4200

You will be presented with the Keycloak login screen:

Keycloak Login

Enter one of the username and password combination created earlier to sign in.

After a successful login you will see the product catalog page: Landing Page

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].