Skip to content

Refactor TEFCA concerns and enhance Udap.Model structure#39

Merged
JoeShook merged 4 commits into
udap-tools:mainfrom
JoeShook:main
Mar 22, 2026
Merged

Refactor TEFCA concerns and enhance Udap.Model structure#39
JoeShook merged 4 commits into
udap-tools:mainfrom
JoeShook:main

Conversation

@JoeShook

Copy link
Copy Markdown
Collaborator

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:

  • Introduced the IAuthorizationExtensionDeserializer interface, 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]
  • Refactored the deserialization logic in PayloadSerializer to 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:

  • Introduced the IAuthorizationExtensionObject interface, providing a common contract for extension objects (validation and purpose_of_use extraction). Updated HL7B2BAuthorizationExtension, HL7B2BUserAuthorizationExtension, and TEFCAIASAuthorizationExtension to 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]
  • Simplified extension validation and purpose_of_use extraction logic to use the shared interface, reducing code duplication and improving extensibility. (Udap.Server/Validation/Default/DefaultUdapAuthorizationExtensionValidator.cs)

TEFCA Extension Refactoring:

  • Moved TEFCAIASAuthorizationExtension into 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]
  • Removed TEFCA-specific constants from the core UdapConstants to decouple TEFCA logic from the main model. (Udap.Model/UdapConstants.cs) [1] [2]

Build and Release Workflow Updates:

  • Updated CI/CD workflows to build, pack, and publish the new Udap.Tefca.Model NuGet package during both prerelease and release jobs. (.github/workflows/prerelease.yml, .github/workflows/release.yml) [1] [2] [3] [4]

Joe Shook and others added 4 commits March 22, 2026 10:20
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
@JoeShook
JoeShook merged commit fef6f6a into udap-tools:main Mar 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant