-
Notifications
You must be signed in to change notification settings - Fork 10
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
[ADMINAPI-1119] - DRAFT - SPIKE: Cross-tenant Admin API Access #215
base: main
Are you sure you want to change the base?
Conversation
131fc4f
to
bd22b71
Compare
}; | ||
}; | ||
|
||
if (!string.IsNullOrEmpty(tenantIdentifier)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On RegisterService, if a tenant as been sent on the request headers, add it to the application permissions.
@@ -56,7 +60,19 @@ public async Task<ClaimsPrincipal> Handle(OpenIddictRequest request) | |||
|
|||
var identity = new ClaimsIdentity(JwtBearerDefaults.AuthenticationScheme); | |||
identity.AddClaim(OpenIddictConstants.Claims.Subject, request.ClientId!, OpenIddictConstants.Destinations.AccessToken); | |||
identity.AddClaim(OpenIddictConstants.Claims.Name, displayName!, OpenIddictConstants.Destinations.AccessToken); | |||
identity.AddClaim(OpenIddictConstants.Claims.Name, displayName!, OpenIddictConstants.Destinations.AccessToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the tenant as a claim to the access token.
@@ -104,6 +105,18 @@ IWebHostEnvironment webHostEnvironment | |||
{ | |||
opt.DefaultPolicy = new AuthorizationPolicyBuilder() | |||
.RequireClaim(OpenIddictConstants.Claims.Scope, SecurityConstants.Scopes.AdminApiFullAccess) | |||
.RequireAssertion(ctx => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if the tenant value on the header matches the one in the token.
Test Results6 tests 6 ✅ 0s ⏱️ Results for commit bd22b71. |
No description provided.