Skip to content

Commit

Permalink
Merge pull request #2052 from solliancenet/cj-fix-authentication-sche…
Browse files Browse the repository at this point in the history
…me-091alpha1

(0.9.1-alpha1) Fix issue with selection of authentication schemes
  • Loading branch information
alistar-andrei authored Dec 11, 2024
2 parents 3d34f07 + e3bab26 commit 4729c3a
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/dotnet/Common/Middleware/CallContextMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ public async Task InvokeAsync(
{
switch (context.User.Identity.AuthenticationType)
{
case JwtBearerDefaults.AuthenticationScheme:
case AgentAccessTokenDefaults.AuthenticationScheme:

// Retrieve group membership when using the Bearer token authentication scheme.
// Retrieve group membership when using the Agent Access Token authentication scheme.
userIdentity.GroupIds = claimsProviderService.GetSecurityGroupIds(context.User) ?? [];

break;

default:

// Retrieve group membership when using standard authentication schemes.
switch (instanceSettings.Value.SecurityGroupRetrievalStrategy)
{
case SecurityGroupRetrievalStrategies.IdentityManagementService:
Expand All @@ -76,16 +83,6 @@ public async Task InvokeAsync(
}

break;

case AgentAccessTokenDefaults.AuthenticationScheme:

// Retrieve group membership when using the Agent Access Token authentication scheme.
userIdentity.GroupIds = claimsProviderService.GetSecurityGroupIds(context.User) ?? [];

break;

default:
break;
}
}

Expand Down

0 comments on commit 4729c3a

Please sign in to comment.