Posts

Showing posts with the label Spring Security

Spring Boot + Keycloak - Securing REST APIs

Image
Hello everyone, Hope you are doing well. In this article, we will learn how to secure the Spring boot REST APIs with Keycloak. The  GitHub repository link is provided at the end of this tutorial.   Technologies Used: Java 11 Spring Boot 2.5.5 KeyCloak 15.0.2 Maven 3 Step 1: Keycloak - Environment Setup Let's download the Keycloak-15.0.2 Standalone server distribution from the official source. Once we've downloaded the Standalone server distribution, we can unzip and start Keycloak from the terminal: In Windows unzip keycloak-12.0.1.zip cd keycloak-12.0.1/bin/ standalone.bat In Linux / Unix  $ sudo tar -xvzf keycloak-12.0.1.tar.gz $ cd keycloak-12.0.1/bin/ $ ./standalone.sh Create Keycloak Server Initial Admin Go to http://localhost:8090/auth/ and fill the form in the Administrator Console part. For the purpose of this exercise, knowledgefactory / password would be enough. Then you should be able to log in to Keycloak Admin Console http://localhost:8080/auth/admin . And,

Kotlin - Spring Security - GitHub OAuth2 Login - Example

Image
Hello everyone, Today we are going to learn how to integrate the GitHub OAuth2 Sign-In by utilizing the Spring Boot application with Gradle build. More Spring Security practice: Spring Boot - Spring Security -Google OAuth2 Login - Example Registration and Login with Spring Boot + Spring Security + Thymeleaf Spring Boot-Authentication and Authorization with Spring Security & JWT Kotlin - Spring Security -Google OAuth2 Login - Example   Generate GitHub OAuth2 credentials 1. Log in to GitHub:  https://github.com/settings/apps 2. Navigate to the OAuth apps section on the left menu, and select New OAuth App 3.  Then, provide Application name, Home Page URL, Authorization callback URL, and register application 4. After clicking the register button, System will generate the Client ID and Client Secret. Now we have successfully created the auth client in the GitHub Creating a Simple Web Application Now we are going to develop a simple web application using Kotlin, Spring Security, and GitH

Spring Boot - Spring Security - GitHub OAuth2 Login - Example

Image
Hello everyone, Today we are going to learn how to integrate the GitHub OAuth2 Sign-In by utilizing the Spring Boot application. More Spring Security examples: Spring Boot - Spring Security -Google OAuth2 Login - Example Registration and Login with Spring Boot + Spring Security + Thymeleaf Spring Boot-Authentication and Authorization with Spring Security & JWT   Generate GitHub OAuth2 credentials 1. Log in to GitHub:  https://github.com/settings/apps 2. Navigate to the OAuth apps section on the left menu, and select New OAuth App 3.  Then, provide Application name, Home Page URL, Authorization callback URL, and register application 4. After clicking the register button, System will generate the Client ID and Client Secret. Now we have successfully created the auth client in the GitHub Creating a Simple Web Application Now we are going to develop a simple web application using Spring Security and GitHub OAuth2 Project Structure: Project Dependency(pom.xml) <? xml version ="1