-
Notifications
You must be signed in to change notification settings - Fork 415
Add Support nested act claim with azp and multi-audience in token request #3028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
dbf8887
8cda162
e0f979c
7a55608
de9aeff
1c4b0e8
51eef55
7700b80
45d0f85
c9b9537
697e0a3
2a1ab5a
00f0aa1
6abcc16
5678abd
8d217e5
6701453
29afe65
22de21d
12d79b5
1ec499b
5015add
edd02f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| import static org.wso2.carbon.identity.oauth.common.OAuthConstants.ACTOR_AZP; | ||
|
|
||
|
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This branch overwrites the nested delegation chain.
🛠️ Minimal fix import static org.wso2.carbon.identity.oauth.common.OAuthConstants.ACTOR_AZP;
+import static org.wso2.carbon.identity.oauth.common.OAuthConstants.IS_DELEGATION_REQUEST;
@@
- } else if (GrantType.AUTHORIZATION_CODE.toString().equals(context.getOauth2AccessTokenReqDTO().getGrantType())
- && context.getRequestedActor() != null) {
+ } else if (GrantType.AUTHORIZATION_CODE.toString().equals(context.getOauth2AccessTokenReqDTO().getGrantType())
+ && context.getRequestedActor() != null
+ && !Boolean.TRUE.equals(context.getProperty(IS_DELEGATION_REQUEST))) {Also applies to: 42-60 🤖 Prompt for AI Agents |
||
| /** | ||
| * A class that provides additional claims for JWT access tokens when the AI agent is used. | ||
| */ | ||
|
|
@@ -20,6 +22,7 @@ public class AgentAccessTokenClaimProvider implements JWTAccessTokenClaimProvide | |
| private static final String SUB = "sub"; | ||
| private static final String AGENT = "AGENT"; | ||
| private static final String AUT = "aut"; | ||
| private static final String AZP = "azp"; | ||
|
|
||
| @Override | ||
| public Map<String, Object> getAdditionalClaims(OAuthAuthzReqMessageContext context) throws IdentityOAuth2Exception { | ||
|
|
@@ -38,8 +41,23 @@ public Map<String, Object> getAdditionalClaims(OAuthTokenReqMessageContext conte | |
| return agentMap; | ||
| } else if (GrantType.AUTHORIZATION_CODE.toString().equals(context.getOauth2AccessTokenReqDTO().getGrantType()) | ||
| && context.getRequestedActor() != null) { | ||
|
|
||
| Map<String, Object> actClaimMap = new HashMap<>(); | ||
| actClaimMap.put(SUB, context.getRequestedActor()); | ||
| // Include azp in act claim from context property | ||
| Object actorAzp = context.getProperty(ACTOR_AZP); | ||
| if (actorAzp != null) { | ||
| actClaimMap.put(AZP, actorAzp.toString()); | ||
| } else { | ||
| // Fallback: use the client_id of the requesting application | ||
| String clientId = context.getOauth2AccessTokenReqDTO().getClientId(); | ||
| if (StringUtils.isNotEmpty(clientId)) { | ||
| actClaimMap.put(AZP, clientId); | ||
| } | ||
| } | ||
|
|
||
| Map<String, Object> agentMap = new HashMap<>(); | ||
| agentMap.put(ACT, Collections.singletonMap(SUB, context.getRequestedActor())); | ||
| agentMap.put(ACT, actClaimMap); | ||
| return agentMap; | ||
| } | ||
| return null; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.