Refactor TEFCA concerns and enhance Udap.Model structure#39
Merged
Conversation
New files in Udap.Model (generic extension points) - IAuthorizationExtensionObject.cs — interface with Validate() and GetPurposeOfUse() for all extension types - IAuthorizationExtensionDeserializer.cs — DI registration interface for custom deserializers New project: Udap.Tefca.Model/ - Udap.Tefca.Model.csproj — references Udap.Model, targets net8.0/net9.0/net10.0 - TefcaConstants.cs — all TEFCA-specific constants (extension keys, XP codes, certification URIs, community URI) - TEFCAIASAuthorizationExtension.cs — moved from Udap.Model, now implements IAuthorizationExtensionObject - TefcaIasDeserializer.cs — implements IAuthorizationExtensionDeserializer - ServiceCollectionExtensions.cs — AddUdapTefcaExtensions() for DI registration Modified in Udap.Model - UdapConstants.cs — removed TEFCAIAS, TEFCASMART, TEFCAIASAuthorizationExtension, TEFCASMARTAuthorizationExtension - HL7B2BAuthorizationExtension.cs — implements IAuthorizationExtensionObject - HL7B2BUserAuthorizationExtension.cs — implements IAuthorizationExtensionObject - PayloadSerializer.cs — accepts IEnumerable<IAuthorizationExtensionDeserializer>?, removed hard-coded TEFCA deserialization Modified in Udap.Server - DefaultUdapAuthorizationExtensionValidator.cs — uses IAuthorizationExtensionObject interface dispatch instead of type-switch - UdapCustomTokenRequestValidator.cs — injects IEnumerable<IAuthorizationExtensionDeserializer> and passes to PayloadSerializer Test/example projects - Added Udap.Tefca.Model project reference and using Udap.Tefca.Model where needed Usage Server projects that need TEFCA support just add: services.AddUdapTefcaExtensions();
Refactor TEFCA concerns and enhance Udap.Model structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new extensibility mechanism for UDAP authorization extension deserialization, enabling support for profile-specific extensions (such as TEFCA) without modifying core code. It also refactors the TEFCA IAS extension into its own package, introduces a shared interface for extension objects, and updates the build and release workflows to include the new TEFCA model package.
Extensibility and Deserialization Improvements:
IAuthorizationExtensionDeserializerinterface, allowing custom deserializers for authorization extensions to be registered and discovered via dependency injection. This enables support for profile-specific extensions (e.g., TEFCA) without changes to core logic. (Udap.Model/UdapAuthenticationExtensions/IAuthorizationExtensionDeserializer.cs,Udap.Model/PayloadSerializer.cs,Udap.Server/Validation/Default/UdapCustomTokenRequestValidator.cs) [1] [2] [3] [4]PayloadSerializerto use both built-in and custom deserializers, and extracted built-in deserialization to a helper method for clarity and maintainability. (Udap.Model/PayloadSerializer.cs) [1] [2] [3]Authorization Extension Object Standardization:
IAuthorizationExtensionObjectinterface, providing a common contract for extension objects (validation and purpose_of_use extraction). UpdatedHL7B2BAuthorizationExtension,HL7B2BUserAuthorizationExtension, andTEFCAIASAuthorizationExtensionto implement this interface. (Udap.Model/UdapAuthenticationExtensions/IAuthorizationExtensionObject.cs,Udap.Model/UdapAuthenticationExtensions/HL7B2BAuthorizationExtension.cs,Udap.Model/UdapAuthenticationExtensions/HL7B2BUserAuthorizationExtension.cs,Udap.Tefca.Model/TEFCAIASAuthorizationExtension.cs) [1] [2] [3] [4] [5] [6]Udap.Server/Validation/Default/DefaultUdapAuthorizationExtensionValidator.cs)TEFCA Extension Refactoring:
TEFCAIASAuthorizationExtensioninto a new package (Udap.Tefca.Model) and added a DI extension method for registering TEFCA extension deserializers. (Udap.Tefca.Model/TEFCAIASAuthorizationExtension.cs,Udap.Tefca.Model/ServiceCollectionExtensions.cs) [1] [2]UdapConstantsto decouple TEFCA logic from the main model. (Udap.Model/UdapConstants.cs) [1] [2]Build and Release Workflow Updates:
Udap.Tefca.ModelNuGet package during both prerelease and release jobs. (.github/workflows/prerelease.yml,.github/workflows/release.yml) [1] [2] [3] [4]