NikiforovAll / keycloak-authorization-services-dotnet

Authentication and Authorization with Keycloak and ASP.NET Core 🔐
https://nikiforovall.github.io/keycloak-authorization-services-dotnet/
MIT License
480 stars 113 forks source link

KeycloakInstallationOptions ConfigurationKeyName Attribute Issue #142

Closed aron-666 closed 1 month ago

aron-666 commented 1 month ago

Description: The ConfigurationKeyName attribute on the AuthServerUrl2 property in the KeycloakInstallationOptions class is currently set to private. This is causing issues with deserialization as the configuration system cannot access the private property.

File: KeycloakInstallationOptions.cs

Current Code:

[ConfigurationKeyName("auth-server-url")]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string AuthServerUrl2 { get; set; } = default!;

Suggested Fix: Change the AuthServerUrl2 property to public to ensure it can be properly deserialized.

Proposed Code:

[ConfigurationKeyName("auth-server-url")]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public string AuthServerUrl2 { get; set; } = default!;

Reason: Making the property public will allow the configuration system to access and bind the value correctly, resolving the deserialization issue. Thank you.

NikiforovAll commented 1 month ago

This is a workaround for configuration binding to support both cases. Having this property public will be confusing.

Please consider using: https://nikiforovall.github.io/keycloak-authorization-services-dotnet/qa/recipes.html#how-to-get-options-outside-of-iserviceprovider