04-Jan-2019
04:59
- last edited on
01-Jun-2023
16:26
by
JimmyPackets
Hello and happy new year 😉
We use APM as OAuth Authorization Server to create JWT token for apps. One of our customers wants to use the MicroProfile JWT(MP-JWT) for his application, that needs some specific claims: https://github.com/eclipse/microprofile-jwt-auth/blob/master/spec/src/main/asciidoc/interoperability...
One requirement is to encode the groups claim in JSON array:
"groups": ["red-group", "green-group", "admin-group", "admin"]
We now try to set the claim with groups from the Active Directory. With an iRule, I filtered the AD groups (from memberOf) and set a new APM variable (session.custom.groups) with this value:
["red-group", "green-group", "admin-group", "admin"]
When I now add a claim groups with %{session.custom.groups} as value, I see that string in my JWT token:
"groups": "[\"red-group\", \"green-group\", \"admin-group\", \"admin\"]"
So the value is escaped and has is in quotation marks.
Is there any chance to send claims as JSON array?
Any help would be appreciated.
24-Jan-2019 01:46
Okay, I now opened a support ticket and let you know about the result.
21-Feb-2019
17:59
- last edited on
01-Jun-2023
16:14
by
JimmyPackets
I believe this is possible (at least on <= 14.1) if you use an iRule event. Something like:
...
set mygroups [ ACCESS::session data get "session.mygroups" ]
append payload {,"mygroups":} "\[$mygroups\]"
...
This is adapted from the example at: https://devcentral.f5.com/wiki/iRules.ACCESS__oauth.ashx
In my AP I have a variable assign with an expression of:
return {"group1","group2"}
22-Feb-2019 00:21
Hi,
yes, this is the easy part; but as we are not using the irule commands but the APM features directly to generate a JWT, i probably cant modify the resulting JWT inside an irule event?
Cheers, Rene
22-Feb-2019 01:44
In my case I had to remove the SSO Bearer Token config from the Access Policy and replace it with an iRule.
22-Feb-2019 02:00
But that wont work when F5 is acting as Authorization server, since it will generate the JWT along with the refresh token through some black-box-magic. If there is any way to modify this generated JWT with an iRule, now this would make me quite happy, but i couldnt find any way to do this.
Also, just for reference, take care when using ACCESS:oauth sign, since it will generate the Token with Base64Uriencoding (without padding), which is different from the actual APM VE config, which will do base64encoding WITH padding for some obscure reason.
22-Feb-2019 02:13
Ah I see. Different use-case, same problem. I was seeing the same issue, but using APM for generating a Bearer token and not as the Authorization server, but the same issue occurs in both.
22-Jan-2019 02:51
Bump! Same question on my side, this is actually a mandatory feature.
Any possibility to do json arrays / lists in a claim?
Thanks!
24-Jan-2019 01:46
Okay, I now opened a support ticket and let you know about the result.
16-Jan-2020 02:11
Hej Daniel,
I have a simular problem,
Did you get information as a result of your ticket that you can share?
Regards,
Peter
16-Jan-2020 02:24
I got this RFE: "BZ724666 [RFE][OAuth AS] Support array of strings in scope value"..
21-Feb-2019
17:59
- last edited on
01-Jun-2023
16:15
by
JimmyPackets
I believe this is possible (at least on <= 14.1) if you use an iRule event. Something like:
 
...
set mygroups [ ACCESS::session data get "session.mygroups" ]
append payload {,"mygroups":} "\[$mygroups\]"
...
This is adapted from the example at: https://clouddocs.f5.com/api/irules/ACCESS__oauth.html
 
In my AP I have a variable assign with an expression of:
 
return {"group1","group2"}
22-Feb-2019 00:21
Hi,
yes, this is the easy part; but as we are not using the irule commands but the APM features directly to generate a JWT, i probably cant modify the resulting JWT inside an irule event?
Cheers, Rene
22-Feb-2019 01:44
In my case I had to remove the SSO Bearer Token config from the Access Policy and replace it with an iRule.
22-Feb-2019 02:00
But that wont work when F5 is acting as Authorization server, since it will generate the JWT along with the refresh token through some black-box-magic. If there is any way to modify this generated JWT with an iRule, now this would make me quite happy, but i couldnt find any way to do this.
Also, just for reference, take care when using ACCESS:oauth sign, since it will generate the Token with Base64Uriencoding (without padding), which is different from the actual APM VE config, which will do base64encoding WITH padding for some obscure reason.
22-Feb-2019 02:13
Ah I see. Different use-case, same problem. I was seeing the same issue, but using APM for generating a Bearer token and not as the Authorization server, but the same issue occurs in both.
08-Apr-2020 12:35
Hi Daniel, I am looking for something similar as well that F5 should provide JWT wherin we have the claims (attributes) values. I ma new to this but I used the guided config and setup F5 as the authorization server, with Postman I can succesfully retrieve the access token and refresh token. I configured the claims in the application on the F5.
How do I actually retreive those values from F5, do I have to provide the access token to F5 as authorization header to be able to retreive this information or should it already be included shile receiving the access token? How to verify this with Postman (I am lacking oauth test APP). Could you eleborate on this and what about this RFE is this fixed now? Thanks a lot
08-Apr-2020 12:41
Hi Marvin,
you can retrieve the claims in the JWT access token.
You need to add token_content_type=jwt to the request and enable JWT in OAUTH profile and Client ID
Example:
https://sso.test.com/f5-oauth2/v1/authorize?redirect_uri=https://localhost&response_type=code&client_id=xyz&token_content_type=jwt
08-Apr-2020 16:03
Hi Daniel, ok thanks that makes sense so you just use GET method not POST? I just tested and F5 replies to the redirect URL with the Access token appended but I dont see any claims info. Inside the oauth profile and client application JWT checkbox is enabled, any thoughts left?
08-Apr-2020 16:10
In de access profile logs I see that session.assigned.oauth.authz.token.claim are being set with correct values so information is being collected
08-Apr-2020 16:17
Also see .session.oauth.authz.jwt_token being set
08-Apr-2020 16:25
I confirm that when using token_content_type=jwt the claim variables are being set with right values except for the fact that its not responding with the JWT and claims information. The only thing is that its being redirected with parameter ?code=xxxxxxx
08-Apr-2020 16:51
I use version 13.1.3
03-Apr-2023 02:56
Solution provided by F5
OAUTH2 JWT Token with custom groups claim (f5.com)