Posts

Showing posts with the label Keycloak

OAuth History and Structure

Image
 OAuth, or open authorization, is a widely adopted authorization framework that allows you to consent to an application interacting with another on your behalf without having to reveal your password. The main purpose of this protocol was to enable users to define user credentials to a central system/application (for example, Google) and to enable other applications using this protocol to perform relevant transactions using only the necessary information of the users. In this way, ,OAuth 2.0 was filled the missing Authorization part of the OpenID protocol with a token based structure. Then, Later an identity layer called OIDC (OpenID Connect) developed on the OAuth 2.0 Framework was added and thus Authentication processes were defined within a standard. OAuth 2.0 Structure In the above picture, you can see the base structure of OAuth 2.0. In the most basic sense, when we as a user ( Resource Owner ) want to access our own data, we enter the relevant website ( Client ) and send a req...

KeyCloak

Image
Keycloak is open source Identity and Access management service for modern applications and services. Add authentication to applications and secure services with minimum fuss. No need to deal with storing users or authentication users. Its all available out of the box. You all even get advanced features such as User Federation, Identity Brokering and Social Login. Features Single Sign on and Single Sign-out Standard Protocols OAuth20, OIDC 1.0, SAML2.0 Flexible Authentication and Authorization Multi Factor Authentication one time passwords Social Login Google, Facebook, Twitter...etc. Provides centralized User management Supports Directory service(AD, LDAP) Customizable and Extensible Easy setup and configurable Core concepts Let's start with Keycloak's core concepts, as shown in Figure 1: Figure 1: Keycloak's core concepts."> A Keycloak  realm  is like a namespace that allows you to manage all of your metadata and configurations. You can have multiple realms based o...

Running Keycloak with docker image

docker run --name keycloak -d -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak: latest start-dev docker stop keycloak docker rm keycloak Again run the above docker run command and see users created already exist or not. so, definitely we will not see as those details are not saving. so, now check how to persist the data with mysql. so, try to configure mysql Step1 create network so that keycloak can talk to Mysql docker network create keycloak-network docker network inspect keycloak-network Step2 start Mysql docker run -p 3306:3306 --name mysql -d --net keycloak-network -e MYSQL_DATABASE=keycloak -e MYSQL_USER=keycloak -e MYSQL_PASSWORD=keycloak -e MYSQL_ROOT_PASSWORD=keycloak mysql Step3 Run keycloak under the same network with addition environment variables docker run -p 8080:8080 --name keycloak -d --net keycloak-network -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -e KC_DB=mysql -e KC_DB_URL=jdbc:mysql://mysql:3306/keycloak...

REST API Authentication using Keycloak as OAuth Provider

Image
REST API Authentication plugin will let you authenticate any application (Jira, Confluence, Bitbucket) APIs using any third-party OAuth/OIDC provider or API Tokens. The app supports Azure AD, Keycloak, Okta, AWS Cognito, Google, Github, Slack, Gitlab, Facebook, and any custom provider Step 1: Configure Keycloak server: In your Keycloak admin console, select the  realm  that you want to use. Go to  Clients  in the left navigation bar and click on   Create . Enter the  ClientID  and select the client protocol as  OpenID-connect  and click on  Save . Select access type as Confidential,  enter the  redirect URL  and click on  save  (Enter the Application's Base URL). To get Client Secret Navigate to  Clients , select  Client Id  and navigate to the  Credentials  tab. Note: Copy the  ClientID  and  Client Secret. Step 2: Fetch Access token through POSTMAN: Open the Postman ...