-
Notifications
You must be signed in to change notification settings - Fork 1
feat: platform access token handling #433
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: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This pull request introduces comprehensive platform access token handling functionality to the Altinn authorization framework. The implementation adds JWT-based token validation for platform-to-platform authentication, with support for multiple token issuers, certificate-based signing key validation, and seamless integration with ASP.NET Core authorization policies and Swagger/OpenAPI documentation.
Key Changes
- Platform Access Token Infrastructure: New authorization requirements, handlers, and attributes for validating JWT-based platform access tokens with configurable issuer approval
- Swashbuckle Integration: OpenAPI documentation support for platform access token authentication schemes
- Security Normalization Improvements: Enhanced security requirement deduplication logic using HashSet-based comparisons to handle duplicate requirements more efficiently
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| SecurityInfoTests.cs | Adds test case for duplicate security requirement handling |
| RequirementAuthorizationPolicySecurityProviderTests.cs | Renames method to align with updated interface |
| DefaultPlatformAccessTokenHandlerTests.cs | New comprehensive test suite for platform access token validation |
| ApprovedIssuersCheckTests.cs | Tests for issuer validation logic |
| TestPlatformAccessTokenSigningKeyProvider.cs | Mock implementation for certificate-based signing key provider |
| TestOptionsMonitor.cs | Test helper for IOptionsMonitor implementation |
| TestHybridCache.cs | Test implementation of HybridCache for .NET 9+ |
| SwaggerPlatformAccessTokenRequirementConditionProvider.cs | Maps platform token requirements to OpenAPI security schemes |
| SwaggerAnyOfScopeAuthorizationRequirementConditionProvider.cs | Class renamed for consistency |
| AltinnSecurityOptions.cs | Updates default values for platform token scheme |
| AltinnSwashbuckleServiceCollectionExtensions.cs | Registers platform token condition provider |
| WellKnownPlatformAccessTokenIssuers.cs | Enum for well-known platform token issuers |
| PlatformAccessTokenSigningKeyProvider.cs | Azure Key Vault-based certificate retrieval |
| PlatformAccessTokenSettings.cs | Configuration settings for platform token validation |
| PlatformAccessTokenRequirement.cs | Internal authorization requirement implementation |
| IPlatformAccessTokenRequirement.cs | Interface for platform token authorization requirements |
| PlatformAccessTokenAuthorizeAttribute.cs | Attribute for platform token authorization |
| PlatformAccessTokenOrScopeAnyOfAuthorizeAttribute.cs | Attribute for platform token OR scope authorization |
| PlatformAccessTokenOrScopeAnyOfAuthorizationRequirement.cs | OR-based authorization requirement |
| DefaultPlatformAccessTokenHandler.cs | Core JWT validation handler |
| IPlatformAccessTokenSigningKeyProvider.cs | Interface for certificate key providers |
| BasePlatformAccessTokenSigningKeyProvider.cs | Base implementation with caching support |
| ApprovedIssuersCheck.cs | Issuer validation logic with optimized lookups |
| AltinnServiceDefaultsAuthorizationServiceCollectionExtensions.cs | DI registration for platform token handlers |
| AltinnAuthorizationPolicyBuilderExtensions.cs | Extension methods for policy configuration |
| SecurityInfo.cs | Improved security requirement normalization with HashSet deduplication |
| OpenApiAuthorizationRequirementConditionProvider.cs | Method renamed for clarity |
| Directory.Packages.props | Package version definitions for new dependencies |
| Altinn.Authorization.ServiceDefaults.Authorization.csproj | Project dependencies for platform token support |
| ResourceController.cs | Sample API demonstrating platform token authorization |
| AdminController.cs | Sample API with platform token attribute |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...zation/Scopes/PlatformAccessToken/PlatformAccessTokenOrScopeAnyOfAuthorizationRequirement.cs
Outdated
Show resolved
Hide resolved
...thorization/Microsoft.AspNetCore.Authorization/AltinnAuthorizationPolicyBuilderExtensions.cs
Show resolved
Hide resolved
...thorization/Microsoft.AspNetCore.Authorization/AltinnAuthorizationPolicyBuilderExtensions.cs
Show resolved
Hide resolved
src/Altinn.Swashbuckle/src/Altinn.Swashbuckle.Abstractions/Security/SecurityInfo.cs
Show resolved
Hide resolved
...erviceDefaults.Authorization/Scopes/PlatformAccessToken/DefaultPlatformAccessTokenHandler.cs
Show resolved
Hide resolved
src/Altinn.Swashbuckle/src/Altinn.Swashbuckle.Abstractions/Security/SecurityInfo.cs
Show resolved
Hide resolved
.../src/ServiceDefaults.Authorization/Scopes/PlatformAccessToken/PlatformAccessTokenSettings.cs
Show resolved
Hide resolved
...eDefaults/test/ServiceDefaults.Authorization.Tests/DefaultPlatformAccessTokenHandlerTests.cs
Outdated
Show resolved
Hide resolved
...eDefaults/test/ServiceDefaults.Authorization.Tests/DefaultPlatformAccessTokenHandlerTests.cs
Outdated
Show resolved
Hide resolved
...eDefaults/test/ServiceDefaults.Authorization.Tests/DefaultPlatformAccessTokenHandlerTests.cs
Outdated
Show resolved
Hide resolved
4a48857 to
d411151
Compare
d411151 to
a24e642
Compare
|
TheTechArch
left a comment
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.
LGTM



This is part 2 of 2 in a stack made with GitButler: