When using the JWT bearer flow, I'm not able to use the role mapper with my LDAP IdP.
I can map user attributes to claims but I can't map group membership to roles.
I double checked the group config in the LDAP IdP and the LDAP structure.
ISSUE copied from #3530 and adapted to the JWT bearer flow.
Expected Behavior
Given the following config for the Domain
Domain
Provider
Role
LDAP provider role mapping
JWT Bearer config
Client settings (in domain config)
For the Client
Client config
Client custom claim to get roles
Current Behavior
If the user is member of the admins group, then he should be affected the role "APP_ADMIN" and the scope "APP_ADMIN" should be added to the OAuth response.
But the role is not attached to the User AND the dynamic scope is not automatically added.
run Apache Directory Studio and have a look to the LDAP structure (localhost:389 ; bind DN: cn=gravitee-am,ou=service-accounts,dc=mycompany,dc=corp bind pwd: gravitee-am base DN: dc=mycompany,dc=corp)
run this command
curl -X POST "http://localhost/am/oidc-ldap/oauth/token?client_id=testing-client&client_secret=testing-client&scope=openid%20roles%20profile&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJraWQiOiJkZWZhdWx0LWdyYXZpdGVlLUFNLWtleSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJqZG9lIiwiYXVkIjoiZ3Jhdml0ZWUgQU0iLCJpc3MiOiJodHRwOi8vdHJ1c3RlZC1wZWVyLWRlbW8iLCJleHAiOjE1ODY4MjEwMDAsImlhdCI6MTU4NjgwNjYwMH0.TGfDnXj2MR-0mBB-YeYTbfPV_DHJV_HRhNlmfkDmDXa4YWSJfWBgMo0Gup5XHScxbLPgjXkGgEDQth5-FNrw3_x6Fcz4CQOap_S9Eju0ERvlfMVi91LioYpxFuBqpQYlMuNC-6DAwVlePz4umStIocwlbq53Pn9v-sGb9iyGCUk7AKwEkFIEoRwOH86PvRoywaZLmN2yoPj3XFs-tsvhoGCmBN-dG-IU3OZGky1eWUd2NZYX7I9fH8zkgmHzDaHVNmNRYDCWRxG2EC-LoAGUO5-4knjDD09MFAq8XpPWSjbO06lPQK7x509zj1CTIZgXlCQLS4aJGfKvNmPZWzzXww"
as you can see in the response payload, the scope is not added and neither is the roles claim.
When using the JWT bearer flow, I'm not able to use the role mapper with my LDAP IdP. I can map user attributes to claims but I can't map group membership to roles.
I double checked the group config in the LDAP IdP and the LDAP structure.
ISSUE copied from #3530 and adapted to the JWT bearer flow.
Expected Behavior
Given the following config for the Domain
Domain
Provider
Role
LDAP provider role mapping
JWT Bearer config
Client settings (in domain config)
For the Client
Client config
Client custom claim to get roles
Current Behavior
If the user is member of the
admins
group, then he should be affected the role "APP_ADMIN" and the scope "APP_ADMIN" should be added to the OAuth response.But the role is not attached to the User AND the dynamic scope is not automatically added.
Request assertion
eyJraWQiOiJkZWZhdWx0LWdyYXZpdGVlLUFNLWtleSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJqZG9lIiwiYXVkIjoiZ3Jhdml0ZWUgQU0iLCJpc3MiOiJodHRwOi8vdHJ1c3RlZC1wZWVyLWRlbW8iLCJleHAiOjE1ODY4MjEwMDAsImlhdCI6MTU4NjgwNjYwMH0.TGfDnXj2MR-0mBB-YeYTbfPV_DHJV_HRhNlmfkDmDXa4YWSJfWBgMo0Gup5XHScxbLPgjXkGgEDQth5-FNrw3_x6Fcz4CQOap_S9Eju0ERvlfMVi91LioYpxFuBqpQYlMuNC-6DAwVlePz4umStIocwlbq53Pn9v-sGb9iyGCUk7AKwEkFIEoRwOH86PvRoywaZLmN2yoPj3XFs-tsvhoGCmBN-dG-IU3OZGky1eWUd2NZYX7I9fH8zkgmHzDaHVNmNRYDCWRxG2EC-LoAGUO5-4knjDD09MFAq8XpPWSjbO06lPQK7x509zj1CTIZgXlCQLS4aJGfKvNmPZWzzXww
Response payload
Steps to Reproduce (for bugs)
cn=gravitee-am,ou=service-accounts,dc=mycompany,dc=corp
bind pwd:gravitee-am
base DN:dc=mycompany,dc=corp
)Signature public key:
Signature private key:
run this command
curl -X POST "http://localhost/am/oidc-ldap/oauth/token?client_id=testing-client&client_secret=testing-client&scope=openid%20roles%20profile&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJraWQiOiJkZWZhdWx0LWdyYXZpdGVlLUFNLWtleSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJqZG9lIiwiYXVkIjoiZ3Jhdml0ZWUgQU0iLCJpc3MiOiJodHRwOi8vdHJ1c3RlZC1wZWVyLWRlbW8iLCJleHAiOjE1ODY4MjEwMDAsImlhdCI6MTU4NjgwNjYwMH0.TGfDnXj2MR-0mBB-YeYTbfPV_DHJV_HRhNlmfkDmDXa4YWSJfWBgMo0Gup5XHScxbLPgjXkGgEDQth5-FNrw3_x6Fcz4CQOap_S9Eju0ERvlfMVi91LioYpxFuBqpQYlMuNC-6DAwVlePz4umStIocwlbq53Pn9v-sGb9iyGCUk7AKwEkFIEoRwOH86PvRoywaZLmN2yoPj3XFs-tsvhoGCmBN-dG-IU3OZGky1eWUd2NZYX7I9fH8zkgmHzDaHVNmNRYDCWRxG2EC-LoAGUO5-4knjDD09MFAq8XpPWSjbO06lPQK7x509zj1CTIZgXlCQLS4aJGfKvNmPZWzzXww"
as you can see in the response payload, the scope is not added and neither is the roles claim.
Your Environment