OIDC and Role mapping from Own DB

44 views
Skip to first unread message

Naresh Shrestha

unread,
Nov 27, 2025, 11:55:00 PMNov 27
to WildFly
Thanks in advance. I just implemented the oidc system which was so fluent. My goal is to implement the Authorization Code flow where OIDC_IDP handles user identity, and WildFly retrieves roles and permission from a local DB. I have mapped the Id and the roles in my database and according to which our application will know the authZ. 

Problem I am facing.
I am now encountering 400 invalid_grant errors and infinite redirect loops, despite ensuring the Allowed Callback URLs in OIDC_IDP exactly match the redirect URIs observed in the browser network logs.  

What I Did:
Created a JDBC Realm: configured to query  user_role table using the OIDC sub ID (oidc_id column) to fetch roles.  

I also tried using aggregate-realm and mapped authN and authZ realm but, later found out this is not the best practice.

How can I solve this problem and what is the best practice to follow?
Wildfly version that I am using is 26.1.2





Naresh Shrestha

unread,
Dec 2, 2025, 12:58:52 AMDec 2
to WildFly
Following up to my question, When we use OIDC Login auth-method automatically create and make use of its own virtual security domain across the deployment. Is there a way to override and let it use custom security domain?

Diana Krepinska

unread,
Dec 5, 2025, 5:55:15 PMDec 5
to WildFly
It isn't possible to override the virtual security domain nor edit it right now. This seems to relate to the unresolved issue https://issues.redhat.com/browse/WFLY-17333 . You can add a vote and add yourself as a watcher on it.

Naresh Shrestha

unread,
Dec 7, 2025, 7:50:49 PM (12 days ago) Dec 7
to WildFly
Sure. Thank you.
Reply all
Reply to author
Forward
0 new messages