Migrate applications off deprecated Keycloak adapters

A plan for replacing the deprecated Keycloak WildFly, servlet and Spring adapters with standard OpenID Connect libraries, with token and logout testing completed before the server upgrade.

On this page

Migrate applications off deprecated Keycloak adapters: what the move involves

Applications still wired to the deprecated Keycloak WildFly, servlet and Spring adapters must move to standard OpenID Connect libraries before the Keycloak server upgrade, and the work is an application-by-application library swap followed by token and logout testing. The effort depends on three things: how many applications you have, how much custom security code each one carries, and how many environments (development, test, staging and production) must be verified. Applications that only use the adapter's default login redirect and session handling are usually the simplest. Applications that read tokens directly, enforce roles in custom filters or manage their own logout are where the time goes.

The adapters are deprecated, so each one is a dependency that will not receive the fixes and features the server line now carries. Keycloak's 26.8 upgrade notes also add behavior that the applications themselves must handle. Mandatory signature validation of backchannel logout tokens from external providers means that any application or relying component receiving logout requests must verify them correctly, not simply accept them. Confirm this behavior in your own logout path before the server upgrade, because an application that accepts unsigned or unverified logout requests will start failing or, worse, appear to work in testing while behaving differently in production.

Build an inventory first. For each application, record the adapter and version in use, the keycloak.json or equivalent configuration, how roles and groups are read from tokens, whether the app stores tokens or cookies, and how single logout is wired. Then decide per application whether to replace the adapter with a standard OIDC library for its language and framework, following the Keycloak server administration guide for client settings and redirect URIs. Plan test cases for login, token refresh, role checks, expired sessions, and logout initiated from each application and from the identity provider, in every environment.

Which adapter features map to standard OIDC libraries and which need rework

This table compares common behaviors of the deprecated Keycloak adapters with their standard OpenID Connect library equivalents and notes what changes in each. Read the rows marked as rework first, since those are where applications need code or configuration changes beyond swapping a library. Confirm library-specific behavior against each library's own documentation before you commit to a design.

Adapter featureStandard OIDC library equivalentMigration notes
Login redirect and authorization code flowAuthorization code flow with PKCE, handled by the library's login middleware or clientMaps cleanly. Register redirect URIs exactly as the new library builds them, and confirm the library requests PKCE for public clients.
Token refreshRefresh token grant, usually handled by the library's token store or session layerMaps with care. Confirm how the library refreshes tokens and how it behaves when the refresh token is rejected, since adapters often hid this from application code.
Role mapping from token claimsRead roles from the access or ID token claims the Keycloak client scopes emit, then map them in application codeNeeds rework when the adapter built roles from realm_access or resource_access automatically. Write an explicit mapper and test each role path.
Session and single logoutFront-channel and back-channel logout endpoints set by the client, plus the library's session handlingDoes not map cleanly. Adapter session handling is specific to the adapter, so design logout propagation again and test it across every application in the same realm.
Bearer token validation for APIsResource server validation of signature, issuer, audience and expiry using the library's JWT validationMaps with rework. Check that audience and issuer checks are set explicitly, because the adapter may have applied them without visible configuration.
Configuration in keycloak.json or adapter XMLIssuer URL, client ID, client secret or key, scopes and redirect settings in the library's own configurationNeeds rework. Move each key to the new library's settings, and remove secrets from files in source control.
Custom role extraction and custom filtersApplication-level claim parsing or custom middleware written against the library's extension pointsNeeds rework. Custom adapter extensions have no direct equivalent, so test each custom path against tokens issued by the upgraded server.
Logout and token handling tests before server upgradeIntegration tests against a staging realm using the new library, covering login, refresh, role checks and logoutPlan this step before the server upgrade so that application behavior is confirmed on the current release first.

How token handling and logout change when adapters are removed

When a Keycloak adapter is removed, the application takes over steps the adapter used to hide. The team must now handle OIDC discovery (reading the realm's .well-known/openid-configuration document to find the authorization, token, JWKS and logout endpoints), the authorization code exchange with PKCE for public clients such as single-page and mobile apps, and validation of every token it accepts. For ID tokens and access tokens, the library or the application code must check the iss value against the expected realm URL, the aud value against the client or API it serves, the signature against keys fetched from the realm's JWKS endpoint, and the exp and nbf claims. Each of these checks is a configuration decision, and a library that is only partly configured can accept tokens that the adapter would have rejected. Confirm the exact settings in each library's documentation rather than assuming defaults match the adapter.

Refresh behavior and session lifetime often change in the swap. Adapters commonly refreshed tokens in ways the application never saw, so the replacement must decide when to call the token endpoint with a refresh token, how long the application session lasts compared with the access token, and what happens when the refresh fails because the realm session has ended. Check the realm's SSO session idle and max settings and the client's offline session settings against what the application now does, because a mismatch can extend a session past what the security team approved or log users out early. Logout needs the same attention. The application must call the end session endpoint for RP-initiated logout, register a back-channel logout URL if it keeps server-side sessions, and handle front-channel logout where it is still used. Test that a logout in one application ends sessions in the others and that the server-side session is removed.

Keycloak 26.8 makes signature validation of backchannel logout tokens from external providers mandatory, according to the 26.8 upgrade notes. This matters for any application that receives logout tokens from an identity provider brokered into Keycloak, or from another realm, because a logout endpoint that accepts unsigned or wrongly signed tokens can be forced to end sessions by an attacker. Before the server upgrade, write test cases that send a valid logout token, a token with a bad signature, a token with the wrong iss or aud, and an expired token to each relying application's back-channel logout endpoint, and confirm the expected accept or reject result. Run the same cases in a staging realm that matches production's brokered providers. Review the upgrade notes for the exact validation rules, since they may affect which providers and token types are in scope.

Which migration path fits each application type

Java web applications deployed on WildFly usually get their Keycloak integration from the server's subsystem and a keycloak.json file, so the container handles login redirects, session cookies and logout. Moving off the deprecated adapter means choosing a standard OpenID Connect library or a supported OIDC option for your WildFly release, then deciding whether the container or the application owns the login flow. Confirm the choice against the WildFly documentation for the version you run.

  • Subsystem settings: Map the realm URL, client ID, client authentication method and redirect rules from the adapter configuration to explicit settings in the application or container.
  • Security constraints: Review the web.xml security constraints and role mappings, because they decide which URLs require login and which roles the token must carry.
  • Session behavior: Confirm session cookie names, timeouts and SameSite handling after the adapter is removed.
  • Deployment cleanup: Remove adapter modules and subsystem entries so that old libraries do not load beside the new one.

Before the server upgrade, test a fresh login, a role-restricted page and a logout from the application, and compare the results with the current behavior. The Keycloak upgrading guide explains which server changes could affect these flows.

How to sequence the adapter migration with a parallel run and cutover

This sequence moves each application from a deprecated Keycloak adapter to a standard OpenID Connect library in controlled waves, so token handling and logout are proven before the old path is removed and the Keycloak server is upgraded.

  1. Inventory every application and adapter

    The application owner and the platform team list each application that uses a WildFly, servlet or Spring adapter, along with the adapter version, the Keycloak configuration file (such as keycloak.json or the Spring properties), the client ID, the protocol mode and any custom code that reads tokens or calls logout. Each application is recorded with its owner, its runtime and its user population. The step is done when every application has a row in one inventory and no adapter dependency is left unassigned.

  2. Classify applications into migration groups

    The team sorts the inventory by risk: internet-facing or regulated applications, internal tools, applications that rely on role claims or custom token mappers, and applications that use back-channel logout. Each group gets a target OIDC library for its language or framework and a named test owner. The output is a ranked list that decides the pilot and the wave order, and it confirms which applications depend on client settings that the new libraries must reproduce.

  3. Build a pilot on a non-production client

    The team creates a separate client in a non-production realm, then rebuilds one low-risk application on a standard OIDC library with its own redirect URIs and scopes. Engineers confirm the login, token refresh and logout paths against that client, and record each setting that differed from the old adapter configuration. The step is done when the pilot signs in, refreshes and logs out in the test environment and the team has a written list of configuration differences to carry into later waves.

  4. Run parallel test logins on staging Keycloak

    The team deploys a staging Keycloak at the target version, which is the version the production server will run after the upgrade, and points both the old adapter build and the new library build of each application at it. Testers run the same scripted flows through both builds, including first login, session expiry, role-based access and single logout across two applications. The output is a comparison record per application showing matching identity, roles and session behavior, with any gaps logged as defects.

  5. Verify token claims and logout in each flow

    For every application, testers decode the ID token and access token from the new library and compare audience, issuer, scope, role and group claims, custom mapper output and token lifetimes against the old adapter's tokens. They also test front-channel and back-channel logout and confirm that a session ended in one application ends in the others. The step is done when each claim difference is either fixed or accepted in writing by the application owner, and every logout path has a recorded pass result.

  6. Migrate applications in waves with both paths live

    The team moves applications to production in waves, starting with the lowest-risk group from the pilot. During each wave, the old adapter build and the new library build run side by side for a window agreed with the business owners, with the old client kept enabled so that a rollback is a deployment change rather than a configuration rebuild. Operations watches login errors, token rejections and support tickets for each wave. A wave closes when its applications show no open defects and the owners sign off.

  7. Test the server upgrade against migrated applications

    Before the production Keycloak is upgraded, the team runs the full suite of migrated application tests against a staging server at the target version, since the upgrade notes for the 26.8 line include changes to backchannel logout token validation and other security defaults that can affect sign-in and logout. Testers confirm that every migrated application still signs in, refreshes and logs out after the upgrade. The step is done when the upgrade has passed against all migrated applications and the rollback steps are written down.

  8. Cut over and decommission adapter code

    After the final wave and the upgrade pass, the team disables the old clients in production, confirms that no traffic still uses the deprecated adapters through login and error logs, and removes the adapter dependencies, configuration files and custom glue code from each application's build. The dependency scan of each repository is run again to confirm no WildFly, servlet or Spring adapter artifacts remain. The output is a closed inventory with each application marked as migrated, the old clients archived and the adapter code removed from source control.

What to test for token handling and logout before the server upgrade

These six areas cover what the application must do with tokens, roles and sessions once it talks to Keycloak through a standard OpenID Connect library. Run them against the new client code while the old server still runs, so any gap shows up before the Keycloak upgrade changes the server side. Keep the evidence from each area in the same change record so the cutover decision rests on observed behavior.

Token validation and claims

This test proves the application accepts only tokens it should accept. Check the issuer, audience, signature algorithm, expiry and clock skew handling against tokens issued by your realm. Confirm that the claims the code reads, such as subject, email and preferred username, appear in the same form the old adapter provided. Keep decoded sample tokens with personal data removed, plus the library configuration that performs the checks.

Keycloak docs

Role and group mapping

This test proves that authorization decisions still match the old behavior. The old adapters mapped realm and client roles into the application's own role model in ways the library may not copy. List every role or group check in the code, then compare the claim the new library reads with the one the old adapter read. Keep a table of test users, their Keycloak roles and the application access each one received before and after.

Token refresh and session expiry

This test proves sessions survive normal use and end when they should. Let an access token expire during an active session and confirm the library refreshes it without a visible login prompt. Then test a refresh token that has passed its session limit and confirm the user is sent to sign in again. Keep timestamped logs of refresh calls and the realm token and session lifetimes in force during the test.

Front-channel and back-channel logout

This test proves that signing out of one application ends the session everywhere it should. Confirm that front-channel logout clears the browser session and that back-channel logout reaches the application endpoint and invalidates its local session. The 26.8 upgrade notes make signature validation of backchannel logout tokens from external providers mandatory, so verify that your logout handler validates those tokens. Keep a log of each logout request and the session state observed afterward.

Upgrading guide

API bearer token acceptance

This test proves that APIs behind the application accept tokens from the correct clients and reject the rest. Send requests with a valid token from an intended client, a token issued to a different client, an expired token and a token with a changed audience. Each case should produce the expected status code. Keep the request and response pairs, and record which audience and authorized party values each API checks.

Error and redirect handling

This test proves that failed logins and mismatched redirects fail safely. Check that a wrong redirect URI, a cancelled login, an expired state parameter and a revoked session each return a clear error page and do not expose tokens in logs or URLs. Confirm that post-logout redirect targets match what the Keycloak client allows. Keep sample error responses and the client redirect and logout URI settings that each case relied on.

What drives the cost and duration of the adapter migration

This table lists the factors that change how much work the adapter migration takes, whether each cost is one-time or recurring, and what to ask for in a quote. Read it before scoping, because the largest drivers are often application ownership and test coverage rather than the library swap itself.

DriverWhy it changes cost or effortOne-time or recurringWhat to ask for in a quote
Number of applications and frameworksEach WildFly, servlet, Spring or other stack needs its own OIDC library, configuration and regression pass, so effort scales with the count of distinct stacks more than with lines of code.One-timeAn application inventory with framework, version and adapter type per item, and a per-stack effort breakdown.
Custom code that reads adapter objectsCode that calls adapter-specific classes such as the access token or security context APIs must be rewritten against standard token claims, which often takes longer than the configuration change.One-timeA list of files or modules that import adapter classes, and how each will read claims after the change.
Number of environments and clientsEach realm, client, redirect URI and environment (development, test, staging, production) needs its own configuration and verification, and client secrets or key settings may differ between them.One-time, with some recurring cost for environment driftConfirmation of how many clients and environments are in scope and how configuration will be kept consistent.
Logout coupling between applicationsSingle logout depends on how sessions, front-channel and back-channel logout are wired across apps, so a change in one app can break sign-out in others and needs joint testing.One-timeA logout test matrix covering every app pair that shares a session, and who signs off on the results.
Customized themes or SPI providersCustom login themes, authenticators and event listeners depend on the server version, so they may need rebuilding and retesting alongside the server upgrade.One-time, then recurring with each Keycloak upgradeWhether custom providers are in scope, their current build method, and the expected upgrade effort for each.
Test coverageApplications with automated login and token tests move faster and with fewer regressions than those tested only by hand, so thin coverage raises both effort and risk.One-time for new tests, recurring for maintenanceWhat tests will be written, which flows they cover, and whether the client keeps them after handover.
Change control and approval windowsProduction changes often wait for fixed change windows and sign-offs, which can stretch the calendar even when the engineering effort is small.Recurring per change windowThe number of planned change windows, the approval steps, and whether rollback steps are part of the plan.
Application ownershipEach application needs an owner who can decide on redirect URIs, token lifetimes, test sign-off and cutover timing, and delays appear when owners are unclear or unavailable.One-time, with ongoing support needs after cutoverA named owner per application and the decisions that owner must make before work starts.

What usually goes wrong when applications leave Keycloak adapters

Adapter removal changes how each application reads tokens, ends sessions and reaches the server. The risks below tend to surface only after a cutover, so each one needs a test that runs before the Keycloak server is upgraded.

Claim and role mapping drift

Adapters mapped roles from specific token claims by default, while a standard OpenID Connect library returns the same data under whatever claim paths the application configures. An app may read realm_access.roles in one place and a client role in another, so users keep their login but lose permissions. Compare decoded tokens from the old and new code paths for the same test user, and confirm each authorization check reads the claim you expect.

Silent logout failures

An application that signs out locally without calling the end-session endpoint leaves the Keycloak session alive, so a user who signs out of one app can still sign into another without a password. Front-channel and back-channel logout also depend on each client's configured logout URL and session handling. Test single logout across every app in the same realm, including sessions that were opened before the change.

Redirect URI mismatches

Standard libraries send the redirect URI they were configured with, and Keycloak rejects any value that does not exactly match a registered redirect URI for the client. Trailing slashes, http versus https, and context paths that differ between the old adapter and the new library are common causes. Export the valid redirect URIs and post-logout redirect URIs for each client, then check every environment against that list before cutover.

Skipped token signature validation

Some hand-rolled integrations decode JWTs without verifying the signature or the issuer and audience claims, which an adapter used to handle. A library left at its defaults may also accept tokens from the wrong client. Confirm each application fetches keys from the realm's JWKS endpoint, rejects tokens with a bad signature, wrong issuer or wrong audience, and fails closed when keys cannot be loaded.

Mismatched session and token lifetimes

Each application now controls its own session length and refresh behavior, and those settings can differ from the server's SSO session and access token lifetimes. One app may keep users signed in long after the Keycloak session has ended, while another forces repeated logins. Record the lifetime each app uses, align them with the realm settings, and test expiry and refresh in each app.

Server upgrade before app testing

Keycloak 26.8 changes behavior that applications may depend on, including mandatory signature validation of backchannel logout tokens from external providers. Upgrading the server before every application has been tested can break logout or token handling for apps that have not moved yet. Finish and verify the library migration for each application on the current server, then schedule the server upgrade with those results in hand. Review the upgrade notes for the target release first.

Keycloak upgrading guide

Questions teams ask before migrating off Keycloak adapters

What does migrating off Keycloak adapters cost?

The cost depends mostly on how many applications use the deprecated adapters, how each one handles sessions and tokens, and how much testing the change needs. The work is paid for either as internal engineering time or as a fixed-scope engagement from a partner. A quote should itemize each application, the OpenID Connect library chosen for its stack, the test environments and the cutover support. Most of the spend is one-time: code changes, test passes and the production cutover. A smaller recurring cost comes from keeping the libraries current and handling their upgrades in each application. Applications with custom filters, custom session stores or unusual logout flows take longer than standard web apps. Ask the quote to state which applications are in scope, which are out of scope and who signs off on each test result.

How long does an adapter migration usually take?

The duration depends on the number of applications, their language and framework, and how many teams own them. Simple web apps with one login path move faster than services that accept bearer tokens or run background jobs that depend on refresh tokens. Change windows and approval cycles often set the pace more than the coding does, because each application needs a staging pass and a production cutover. Ownership gaps add time when no one can confirm test accounts or redirect URIs. Ask the vendor or partner to show the phases, the dependencies between applications and the points where your team must sign off. No single figure fits every stack, so treat any estimate as provisional until your own application inventory has been completed and reviewed.

What must our team provide before the migration starts?

Start with an inventory: each application, its business and technical owner, its language and framework, the adapter type and version it uses, and the Keycloak client it relies on. Add the redirect URIs, post-logout redirect URIs, scopes and the roles or groups each application reads from tokens. Provide test accounts for every role, including users in each group that the application checks. Name an owner who can approve test results and an engineer who can explain how each application manages sessions. Confirm that the staging environment matches production closely enough to test logout, and agree on change windows and rollback steps. Undocumented clients and missing owners usually cause the most delay, so collect these items before any code changes are scheduled.

Can our internal team migrate these adapters without outside help?

An internal team can do the work if it has engineers who understand OpenID Connect flows, the libraries for each application stack and the Keycloak client settings. The main drivers are the number of stacks, the amount of custom token code and whether engineers can spare time alongside their regular work. Teams that have not validated tokens or tested logout across several applications usually benefit from an independent review before cutover. A partner can take on the work under a written, fixed scope, with deliverables and timelines agreed before work starts, or can cover only the testing and review. DeployOpen plans, implements and tests this kind of work inside the client's own infrastructure. Compare the internal plan with a written scope, and confirm which tests and sign-offs each option includes.

Does the Keycloak server upgrade have to wait?

Not always, but the order matters. The Keycloak 26.8 upgrade notes make signature validation of backchannel logout tokens from external providers mandatory, so applications and brokered identity providers that rely on logout need checking before the server moves. Breaking changes in minor releases are opt-in, according to the project's release notes, but the upgrade guide still lists steps to confirm for each target version. Confirm that the library version in each application works with the target server. Many teams move applications to the new libraries first, upgrade the server in a staging environment, and then run production cutovers. Review the upgrading guide for the exact target version before you set the order.

How do we test logout without affecting production users?

Test logout in a staging realm that holds test users and clients copied from production settings, never with live accounts. Cover each logout path the application supports: local logout, front-channel logout through the browser and back-channel logout initiated by Keycloak. For each path, sign in to two or more applications, trigger logout from one and confirm that every other application ends its session and rejects the old tokens or cookies. Repeat the tests after the library change and again after the server upgrade. Record the expected result for each application, and include cases where the session expires or a user is disabled. Confirm that post-logout redirect URIs are registered and that each application returns the user to the correct page. Keep test changes in the staging realm so they stay separate from production configuration.

Which token checks matter most during the switch?

Check that each application validates the token signature against the realm keys, the issuer, the audience and the expiry time. Confirm that the application reads roles and groups from the claims the realm actually emits, because older adapters often mapped these automatically and the new library may not. Test refresh token behavior, including what happens when a refresh fails after the session has ended. Public clients such as single-page apps should use the authorization code flow with PKCE, and tokens should not sit anywhere scripts can read them unless the design requires it. Check state and nonce handling on callbacks, and confirm that APIs reject tokens with the wrong audience. Log validation failures so the first days in production show which checks are missing. Keep a list of the claims each application depends on and test them after every change.

How the parallel run and cutover fit together

The path starts with an inventory of every application that loads a deprecated adapter, then sorts each one by its token and logout behavior. A pilot application gets its library swapped and is tested against a staging Keycloak at the target version. A failed token or logout test sends the work back to rework rather than forward. Once tests pass, the new and old integrations run side by side, then applications move in waves before the old adapter is removed.

Phases from adapter inventory through wave cutover, with a test gate that loops back to rework.

What the client team provides and what DeployOpen delivers

The client team provides the material that makes an adapter migration plannable. The most important item is an application inventory listing every application that uses a deprecated Keycloak adapter (the WildFly, servlet or Spring adapter), its runtime and framework version, its Keycloak client ID and client type, its redirect URIs and post-logout redirect URIs, and the roles or groups its code checks. Alongside it, the client needs source code access or a build pipeline for each application, test accounts covering each role and each identity source, a named owner for every application who can decide on behavior changes, the non-production and production environments available for testing, and the change windows in which each application can be cut over. Ask each owner which back-channel logout endpoints and session timeouts their application depends on, because those are the settings most often missing from a configuration export.

DeployOpen delivers the migrated applications, the test evidence and the operating documents. For each application, the work covers replacing the adapter with a standard OpenID Connect library, mapping token claims and roles to the application's authorization checks, and testing login, token refresh, logout and back-channel logout against the target Keycloak version. The deliverables are the migrated application code or merge requests, a test report recording which flows passed in which environment, a runbook for each cutover with its order of steps and verification checks, and a rollback plan that states how to restore the adapter-based build and client configuration if a cutover fails. Where the Keycloak server upgrade is in the same plan, the rollback plan must cover both the client and the server state.

The scope, deliverables and timelines are agreed in writing before work starts. The written scope lists the applications in and out of scope, the target Keycloak version and the environments used for acceptance testing, the test cases each application must pass, and the named owners who sign off each cutover. Timelines depend on the inventory and the change windows the client can offer, so the client should confirm both before a quote is requested. Any change to scope after signing goes through the same written process, with the effect on timeline and cost stated before the work continues.

How DeployOpen scopes, delivers and supports the adapter migration

DeployOpen approaches the move off deprecated Keycloak adapters as a fixed-scope engagement inside your own infrastructure. The work covers inventory, replacement with standard OpenID Connect libraries, token and logout testing, and handover so your team can run the applications after the server upgrade.

How we scope

  • Inventory every application using the WildFly, servlet or Spring adapter, with its runtime and framework version.
  • Record each client's flows, redirect URIs, token use, logout behavior and session dependencies in one written list.
  • Agree in writing which applications move in this engagement, which are retired, and what the server upgrade requires.

How we build

  • Replace each adapter with a standard OpenID Connect library chosen for the application's stack and runtime.
  • Configure clients, scopes and token validation so resource servers verify signatures and audiences correctly.
  • Run token handling and front-channel and back-channel logout tests against a staging Keycloak before any production cutover.

How we hand over

  • Deliver the code changes, client configuration and test results as a documented package your team can review.
  • Document the cutover sequence, rollback steps and the settings each application needs after the server upgrade.
  • Walk your engineers through the replaced libraries, token checks and logout behavior so they can maintain them.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Confirm with your team which support level, response expectations and retest scope apply before signing the scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.