Spring Boot KeyCloak Demo

Overview

Spring Boot(Kotlin) + Spring Security + Keycloak Demo

Docker Keycloak + MariaDB 설정 및 기본 KeyCloak 사용법

  1. Keycloak 이미지와 MariaDB 이미지를 다운 받는다.
[root@~]# docker pull jboss/keycloak
[root@~]# docker pull mariadb
  1. Docker network 를 생성한다.
[root@~]# docker network create keycloak-network
  1. MariaDB 인스턴스를 생성한다.
[root@~]# docker run -d --name mariadb \
--net keycloak-network \
-p 3300:3306 \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=keycloak \
-e MYSQL_USER=keycloak \
-e MYSQL_PASSWORD=secret \
mariadb
  1. Keycloak 인스턴스를 생성한다.(참고-Keycloak Docker 설정)
[root@~]# docker run -d --name keycloak \
--net keycloak-network \
-p 8000:8080 \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=secret \
-e DB_ADDR=mariadb \
-e DB_PORT=3306 \
-e DB_DATABASE=keycloak \
-e DB_PASSWORD=secret \
-e DB_USER=keycloak \
jboss/keycloak
  1. 정상적으로 Keycloak 인스턴스가 생성되었다면 브라우저에 http://127.0.0.1:8000/auth/ 주소고 접속하면 Welcome to Keycloak 사이트가 나올 것이다. 여기서 Administration Console 로 접속하면 된다. keycloak-index

  2. 5번이 정상적으로 완료가 되었다면 MariaDB에 접속하면 keycloak 데이터베이스에 keycloak 관련 테이블이 생긴것을 확인 할 수 있다. keycloak-tables

  3. Keycloak 관리자에서 4번에서 설정한 아이디와 비밀번호로 접속을 합니다. keycloak-login keycloak-login-success

  4. 왼쪽 상단 Master 에 마우스를 올려두면 Realm 을 생성 할 수 있다. 신규 Realm 을 하나 생성한다. Realm 이름은 SpringBootKeycloak 이다.

  5. 왼쪽 Client 메뉴로 이동 후 Create 버튼을 클릭하여 Client 를 생성합니다. Client 이름은 login-app 이다. keycloak-demo-1

  6. Client 생성한 뒤 이동된 페이지의 하단에 Valid Redirect URIs 항목에 http://127.0.0.1:8000/* 을 입력 후 맨 하단의 Save 버튼을 누릅니다. keycloak-demo-2

  7. 왼쪽 Roles 메뉴로 이동 후 Add Role 버튼을 클릭하여 user 라는 Role 을 생성한다. keycloak-demo-3

  8. 왼쪽 Users 메뉴로 이동 후 Add user 버튼을 클릭하여 user1 이라는 사용자를 생성한다. keycloak-demo-4

  9. user1 생성 후 Credentials 탭으로 이동 후 비밀번호를 설정 후 하단의 Set Password 버튼을 누른다. keycloak-demo-5

  10. 상단 Role Mappings 탭으로 이동 후 Available Roles 에서 11번에서 생성한 user Role 을 클릭 후 Ad Selected 버튼을 클릭하면 user Role 이 Assigned Roles 로 이동한다. 이렇게 되면 완료된 상태이다. keycloak-demo-6

You might also like...
API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

Push notification application using One Signal + Spring Boot + Kotlin

Spring Boot push notification system using One Signal This project was created to demonstrate a simple application built with Kotlin + Spring Boot inc

Kotlin Based Spring Boot ETL project
Kotlin Based Spring Boot ETL project

Adverity ETL REST API (AERA) A simple ETL Spring Boot application with H2. This API provides the following basics functionalities: Endpoint that retur

Spring Boot Webflux RDBMS Sample App

R2DBC Spring Boot Webflux Sample Project generate schema (DDL script) h2-console (Web based database management console) WebFlux and r2dbc is not supp

Solution for task 5 on Spring Boot https://t.me/try2py/197

IouRestService (Spring Boot Application) Решение задачи 5 https://t.me/try2py/197 Условие задачи: Четверо соседей по комнате имеют привычку занимать д

GraphQL for Java with Spring Boot made easy.

GraphQL for Java with Spring Boot made easy.

Spring boot admin server for android

spring-boot-admin-server 어드민 서버 그래들 implementation("org.springframework.boot:spring-boot-starter-security:2.5.6") // https://mvnrepository.com/artifac

API Rest With Kotlin And Spring Boot

##API REST WITH KOTLIN AND SPRING BOOT GET Url: http://localhost:8080/customers Response (Status Code: 200 Ok) { "_embedded": { "customer

Créer un microservice avec Spring Boot et Kotlin
Créer un microservice avec Spring Boot et Kotlin

🚀 Créer un microservice avec Spring Boot et Kotlin Ce dépôt contient les slides et la démo du talk "créer un microservice avec Spring Boot et Kotlin"

Owner
Developer
null
Spring-graphql-getting-started - Spring for GraphQL provides support for Spring applications built on GraphQL Java

Getting Started with GraphQL and Spring Boot Spring for GraphQL provides support

Shinya 0 Feb 2, 2022
Michal Kubele 0 Jan 6, 2022
Spring Boot Example with Kotlin and Domain Driven Design

Spring Boot Kotlin Domain Driven Design Example Just an example project where ddd is implemented with some other great patterns and architecture from

Fernando Guevara Sanchez 16 Jun 29, 2022
A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Dario Mungoi 7 Sep 17, 2022
Sample Social Login Project of Spring Boot and Kotlin

Sample-Spring-Boot-Social-Kotlin Sample Social Login Project of Spring Boot and Kotlin dependencies dependencies { implementation("org.springframewor

Seokhyun 2 Oct 11, 2021
This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping

Kotlin spring-boot nested config props This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping @Constru

Maksim Kostromin 1 Oct 11, 2021
My personal template for a Spring Boot REST reactive webapp

My personal spring boot kotlin reactive template Features Spring Security implementation with JWT access and refresh token MongoDB database Project Co

Dušan 2 Dec 1, 2021
Generated with spring boot kotlin starter kit

Kotlin backend Generated with spring boot kotlin starter kit The idea is to: Get a microservice written in kotlin for managing users and roles. To be

Oriol Subirana 1 Oct 19, 2021
The Okila server project uses the Spring boot framework and uses the Kotlin language

Okila-Server The Okila server project uses the Spring boot framework and uses the Kotlin language Format Response //The response successfully format

Nankai 1 Oct 25, 2021
An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL

graphql-kotlin-spring-server An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL Running the s

null 0 Oct 31, 2021