Skip to content

OAuthSection#15

Open
prestoncraw wants to merge 5 commits into
developmentfrom
OAuthSection
Open

OAuthSection#15
prestoncraw wants to merge 5 commits into
developmentfrom
OAuthSection

Conversation

@prestoncraw

Copy link
Copy Markdown
Contributor

Add public const SettingsSection

@prestoncraw prestoncraw requested a review from clackner-gpa June 3, 2026 19:44
/// </summary>
/// <param name="claimsPrincipal">The claims principal to extend.</param>
/// <param name="providerIdentity">The identity of the authentication provider.</param>
void ExtendClaimPrincipal(ClaimsPrincipal claimsPrincipal, string providerIdentity);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps if an application needs to extend the claims principal using a third-party data service, we should consider using Microsoft's IClaimsTransformation interface.

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/claims?view=aspnetcore-7.0#extend-or-add-custom-claims-using-iclaimstransformation

I don't see how shimming it into IAuthenticationSetup is easier or better.


Also, the word Claims is plural in ClaimsPrincipal.

Suggested change
void ExtendClaimPrincipal(ClaimsPrincipal claimsPrincipal, string providerIdentity);
void ExtendClaimsPrincipal(ClaimsPrincipal claimsPrincipal, string providerIdentity);

public string LongDescription => string.Empty;
}

//Constants

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//Constants
// Constants

Comment on lines +60 to +64
//Constants
/// <summary>
/// The section of the configuration file used to configure the provider when using the default options.
/// </summary>
public const string SettingsSection = "WindowsAuthentication";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is incorrect. There is no code in Gemstone.Security that actually uses the Settings API to populate the WindowsAuthenticationProviderOptions, and this property is unused as far as the WindowsAuthenticationProvider API is concerned. The code which initializes the Settings instance, calls DefineSettings(), and assigns the values to the WindowsAuthenticationProviderOptions instance is all in openHistorian.

private static partial Regex SpecialCharacterPattern();

/// <summary>
/// Defines the settings used to configure the <see cref="OAuthAuthenticationProvider"/> in the Configuration File.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Defines the settings used to configure the <see cref="OAuthAuthenticationProvider"/> in the Configuration File.
/// Defines the settings used to configure the <see cref="WindowsAuthenticationProvider"/> in the Configuration File.

Comment on lines +320 to +321
section.LDAPPath = ("", "LDAP path to use for Windows Authentication");
section.AllowLocalAccounts = (false, "Allow local accounts to authenticate with Windows Authentication");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these descriptions, taken from the doc comments on the properties in the WindowsAuthenticationProviderOptions class, are better.

Suggested change
section.LDAPPath = ("", "LDAP path to use for Windows Authentication");
section.AllowLocalAccounts = (false, "Allow local accounts to authenticate with Windows Authentication");
section.LDAPPath = ("", "Root path from which LDAP searches should be performed");
section.AllowLocalAccounts = (false, "Indicates whether the UI will also search local Users and Groups");

/// Defines the settings used to configure the <see cref="OAuthAuthenticationProvider"/> in the Configuration File.
/// </summary>
/// <param name="settings">The settings to define.</param>
public static void DefineSettings(Settings settings)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frankly, I'm rather against including any hooks to the Settings API in these classes, since the application developer should be the one to decide what data sources should be used for configuration and, by extension, what API it should use to access configuration data.

To further solidify my point, refer to my previous comment about how there isn't actually any code in this API to read data from the Settings API and populate the WindowsAuthenticationProviderOptions class. If you were to add that code here, it would only serve to deepen the coupling between this API and the Settings API, eroding the application developer's freedom to choose a more appropriate configuration source for their application.

The knock-on effects of coupling the Settings API with other Gemstone APIs can already be seen in some of our command line tools where we were forced to place a superfluous call to the Settings class' constructor in order to avoid spurious NullReferenceExceptions at runtime!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prestoncraw prestoncraw requested a review from StephenCWills June 9, 2026 13:18
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.

2 participants