Keycloak for Beginners

Keycloak for Beginners

Every core Keycloak concept a beginner needs to know — explained in plain, simple language with real-world analogies. No prior identity or security experience required.

Keycloak is one of the most widely used open-source tools for handling login, user management, and access control across applications. Instead of every application building its own login page and password storage from scratch, Keycloak centralizes all of that in one place. If you have never worked with identity and access management before, terms like “realm,” “client,” and “token” can sound intimidating. This guide breaks every beginner concept down into plain language, with everyday analogies, so you build a solid mental model before touching any configuration screen.

1Keycloak & IAM Fundamentals

Before touching Keycloak itself, you need the vocabulary around identity and access management that every other concept builds on.

C1 What is Keycloak?

Keycloak is a free, open-source tool that handles login, user accounts, and permissions for other applications, so developers don’t have to build their own login system from scratch for every app they create.

C2 What is Identity and Access Management (IAM)?

IAM is the general term for systems that manage who a user is (identity) and what they’re allowed to do (access) within one or more applications. Keycloak is one specific tool that provides IAM.

C3 What is Authentication?

Authentication is the process of proving who you are — typically by entering a username and password, or using something like a fingerprint or a one-time code sent to your phone.

C4 What is Authorization?

Authorization happens after authentication and decides what an already-identified user is allowed to do — for example, whether they can view a page, edit a record, or access an admin panel.

Everyday Analogy

Think of a concert venue: showing your ticket at the door is authentication (proving you are who you say you are), while the color of your wristband deciding whether you can enter the VIP area is authorization (what you’re allowed to do once inside).

C5 What is Single Sign-On (SSO)?

Single Sign-On lets a user log in once and then access multiple different applications without having to log in again separately for each one — Keycloak is commonly used specifically to provide this experience.

C6 What is an Identity Provider (IdP)?

An identity provider is the system responsible for authenticating users and confirming their identity to other applications. Keycloak itself acts as an identity provider for the apps connected to it.

C7 What is a Service Provider (SP)?

A service provider is an application that relies on an identity provider (like Keycloak) to handle login, rather than managing its own usernames and passwords directly.

C8 Why is Keycloak Open Source?

Keycloak is open source, meaning its code is publicly available for anyone to inspect, use, and modify for free, which is one reason it’s widely trusted and adopted for handling something as sensitive as user login.

i
Beginner Tip

You’ll see Keycloak described as an “Identity and Access Management” solution — that phrase simply means it handles both proving who someone is and controlling what they can do.

2Core Building Blocks

These are the handful of objects you’ll see constantly inside Keycloak’s admin console — understanding them makes everything else click into place.

C9 What is a Realm?

A realm is an isolated space in Keycloak that manages its own set of users, applications, and settings — completely separate from any other realm. Most organizations create one realm for their entire company or product.

C10 What is a Client?

In Keycloak, a “client” refers to an application (a website, mobile app, or backend service) that is registered with Keycloak so it can use Keycloak for login and permission checks.

C11 What is a User?

A user is an individual person’s account stored inside a realm, including their username, credentials, and profile information like email or name.

C12 What is a Role?

A role represents a permission or a level of access, such as “admin” or “editor,” that can be assigned to users to control what they’re allowed to do.

C13 What is a Group?

A group is a way to organize multiple users together and assign roles or settings to the whole group at once, instead of configuring each user individually.

C14 What is the Master Realm?

The master realm is a special, default realm used specifically to manage Keycloak itself — creating other realms, managing overall server settings, and controlling top-level administrators.

C15 What is the Admin Console?

The admin console is the web-based dashboard where administrators configure realms, clients, users, and roles — it’s the main interface you use to manage everything in Keycloak.

Isolation

Realm

A self-contained space — users and settings in one realm never mix with another realm.

App

Client

Any application registered to use Keycloak for its login and access checks.

Person

User

An individual account with credentials and profile details inside a realm.

Permission

Role

A label representing what a user is allowed to do, assigned to users or groups.

3Authentication Basics

This chapter covers what actually happens when a user tries to log in through Keycloak.

C16 What is a Login Flow?

A login flow is the sequence of steps a user goes through to prove their identity — such as entering a username and password, and possibly a second verification step afterward.

C17 What is the Keycloak-Hosted Login Page?

Instead of each application building its own login form, Keycloak provides a ready-made login page that users are redirected to, which keeps the login experience consistent and secure across all connected applications.

C18 What is Username/Password Authentication?

This is the most common authentication method, where a user proves their identity by entering a username (or email) along with a matching secret password.

C19 What is a Credential?

A credential is any piece of information used to prove identity, most commonly a password, but it could also be a one-time code or a security key, depending on how authentication is configured.

C20 What are Required Actions?

Required actions are tasks a user must complete before they can finish logging in — for example, being forced to update an expired password or verify their email address on first login.

C21 What is a Password Policy?

A password policy defines the rules passwords must follow in a realm, such as minimum length or requiring a mix of letters and numbers, to encourage stronger, harder-to-guess passwords.

C22 What is Brute Force Detection?

Brute force detection temporarily locks or slows down an account after too many failed login attempts, protecting against automated programs trying to guess a password repeatedly.

flowchart LR
    U["User"] -->|1. Wants to log in| App["Client Application"]
    App -->|2. Redirect| KC["Keycloak Login Page"]
    U -->|3. Enters credentials| KC
    KC -->|4. Verifies identity| KC
    KC -->|5. Sends token| App
    App -->|6. User is logged in| U
    

FIG 3.1 — A simplified view of an application redirecting a user to Keycloak to log in.

4Protocols & Tokens

Keycloak communicates with applications using well-known industry standards. This chapter introduces them at a beginner level.

C23 What is OAuth 2.0?

OAuth 2.0 is an industry-standard protocol that allows one application to access resources on behalf of a user without ever seeing that user’s password — Keycloak implements this standard to handle secure logins.

C24 What is OpenID Connect (OIDC)?

OpenID Connect is a layer built on top of OAuth 2.0 specifically designed for verifying a user’s identity (rather than just granting access to resources) — it’s the most common protocol Keycloak uses for login.

C25 What is SAML?

SAML (Security Assertion Markup Language) is an older, XML-based protocol also used for single sign-on, still common in some enterprise systems, and supported by Keycloak alongside OpenID Connect.

C26 What is an Access Token?

An access token is a piece of digital proof, issued by Keycloak after a successful login, that an application uses to confirm the user is authenticated and to check what they’re allowed to access.

C27 What is a Refresh Token?

A refresh token is a longer-lived credential used to obtain a new access token once the original one expires, without forcing the user to log in again from scratch.

C28 What is an ID Token?

An ID token contains basic information about who the user is (like their name or email), and is meant to be read directly by the application, unlike the access token which is meant for accessing resources.

C29 What is a JWT (JSON Web Token)?

A JWT is a compact, digitally signed text format used to represent tokens like access tokens and ID tokens — Keycloak issues its tokens in this format so applications can verify they haven’t been tampered with.

!
Common Beginner Confusion

An access token proves what you can do; an ID token proves who you are. They look similar but serve different purposes — this is one of the most common points of confusion for beginners.

5Client & App Integration

This chapter covers the settings you configure when connecting a real application to Keycloak.

C30 What is a Client ID?

A client ID is a unique name that identifies a specific application when it talks to Keycloak, similar to a username for the application itself rather than for a person.

C31 What is a Client Secret?

A client secret is a private password-like value used by confidential applications to prove their own identity to Keycloak, kept hidden and never exposed to end users or browsers.

C32 What is a Redirect URI?

A redirect URI is the exact web address Keycloak is allowed to send a user back to after a successful login — configuring this correctly prevents login responses from being sent to the wrong, potentially malicious, destination.

C33 What is the Difference Between a Public Client and a Confidential Client?

A public client (like a single-page web app or mobile app) cannot safely store a secret, so it relies on other protections, while a confidential client (like a backend server) can securely store a client secret and use it during login.

C34 What are Client Scopes?

Client scopes define what specific pieces of information (like email or profile details) are included in the tokens issued to a particular client, controlling how much data the application receives about the user.

C35 What is a Client Adapter?

A client adapter is a small library that helps an application integrate with Keycloak more easily, handling details like redirecting users to log in and validating tokens, so developers don’t have to build that logic manually.

Public Client

  • Used for browser and mobile apps
  • No client secret stored
  • Relies on redirect URI validation

Confidential Client

  • Used for backend/server apps
  • Stores a client secret securely
  • Stronger authentication of the app itself

6Roles & Permissions Basics

Roles are how Keycloak expresses “what a user is allowed to do” — this chapter covers the beginner-level role concepts.

C36 What is a Realm Role?

A realm role is a permission that exists at the realm level and can potentially apply across multiple applications within that same realm, such as a general “admin” role.

C37 What is a Client Role?

A client role is a permission specific to one particular application, such as “invoice-editor” that only makes sense within a billing application, rather than realm-wide.

C38 What is a Composite Role?

A composite role is a role that automatically includes one or more other roles, so assigning one composite role to a user effectively grants them several permissions at once.

C39 What is Role Mapping?

Role mapping is the act of assigning a specific role to a specific user or group, connecting the permission (role) to the person who should have it.

C40 What are Default Roles?

Default roles are roles automatically assigned to every new user created in a realm, useful for ensuring all users start with some baseline set of permissions without manual setup.

7User Management Basics

Keycloak can either store users itself or connect to existing user directories — here are the beginner concepts around that.

C41 What is User Federation?

User federation lets Keycloak connect to an existing external system (like a company directory) that already stores users, instead of requiring every user to be recreated inside Keycloak from scratch.

C42 What is LDAP Integration?

LDAP is a common protocol many organizations already use to store employee accounts — Keycloak can connect to an LDAP directory through user federation, so existing company logins work without duplication.

C43 What are User Attributes?

User attributes are extra pieces of information stored on a user’s profile beyond the basics, such as a department name or an employee ID, which can be customized per organization’s needs.

C44 What is a User Session?

A user session represents an active, logged-in period for a user — Keycloak tracks sessions so it knows a user is still logged in, and can end that session if the user logs out or it expires.

C45 What is the Account Console?

The account console is a self-service page where an individual end user (not an administrator) can update their own profile, change their password, or review their active sessions.

8Keycloak Ecosystem & Deployment

A few final concepts around how Keycloak is actually run and customized in the real world.

C46 What is Standalone Mode?

Standalone mode refers to running a single Keycloak server instance directly, typically used for development or small deployments, as opposed to a larger clustered setup.

C47 What is Docker Deployment?

Docker deployment means running Keycloak inside a lightweight, portable container, which makes it easy to start, stop, and move a Keycloak instance consistently across different machines.

C48 What is the Keycloak Database?

Keycloak stores all of its data — realms, users, roles, and settings — in a backing database (such as PostgreSQL), which persists this information even if the Keycloak server itself restarts.

C49 What are Themes?

Themes let you customize the look and feel of Keycloak’s login and account pages, so they can match your company’s branding instead of using the default Keycloak design.

C50 What is Events Logging?

Events logging records important activities like logins, failed login attempts, and account changes, which helps administrators monitor usage and investigate suspicious activity later.

9Frequently Asked Questions

Q1 Do I need to know OAuth 2.0 in depth to start using Keycloak?

Not at the beginner stage. Keycloak handles most of the OAuth 2.0 complexity for you — a basic understanding of tokens and login flows is enough to get started using it in an application.

Q2 Can one Keycloak server manage multiple unrelated applications?

Yes — through realms and clients, a single Keycloak server can manage login and permissions for many completely separate applications, each configured as its own client, optionally within separate realms.

Q3 What’s the difference between a realm role and a client role?

A realm role can conceptually apply across the whole realm, while a client role is scoped specifically to one application — use client roles when a permission only makes sense within one particular app.

Q4 Is Keycloak only for large enterprises?

No — because it’s free and open source, Keycloak is used by projects of all sizes, from small personal apps to large enterprise systems needing centralized login across dozens of applications.

Q5 Do end users ever see the word “Keycloak”?

Not necessarily — with custom themes, the login page can be fully rebranded to look like part of your own application, so users may never realize Keycloak is working behind the scenes.

10Summary & Key Takeaways

What You Should Remember

  • Keycloak centralizes authentication and authorization so applications don’t need to build their own login systems.
  • A realm is an isolated space containing its own users, clients, roles, and groups.
  • Applications connect to Keycloak as clients, either public (browser/mobile apps) or confidential (backend servers with a client secret).
  • Login relies on industry-standard protocols — mainly OpenID Connect (built on OAuth 2.0) and, in some systems, SAML.
  • After login, Keycloak issues an access token, ID token, and refresh token, all typically formatted as JWTs.
  • Roles (realm or client-level) define what a user can do, and role mapping connects roles to users or groups.
  • User federation, such as LDAP integration, lets Keycloak work with existing company user directories instead of duplicating accounts.
  • Keycloak can run standalone or in Docker, stores its data in a backing database, and supports themes for full branding control.