Repository navigation
AOT 1: Expose authentication configuration handlers from Abstractions #4816
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
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...a.SqlClient.Extensions/Abstractions/doc/SqlAuthenticationProviderConfigurationSection.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <!-- | ||
| Licensed to the .NET Foundation under one or more agreements. | ||
| The .NET Foundation licenses this file to you under the MIT license. | ||
| See the LICENSE file in the project root for more information. | ||
| --> | ||
| <docs> | ||
| <members name="SqlAuthenticationProviderConfigurationSection"> | ||
| <SqlAuthenticationProviderConfigurationSection> | ||
| <summary> | ||
| The configuration section definition for reading app.config. | ||
| This infrastructure type is not intended for direct use by application code. | ||
| </summary> | ||
| <remarks> | ||
| <para>Defines the legacy <c>SqlAuthenticationProviders</c> section for authentication configuration.</para> | ||
| <para> | ||
| This type is public to support use across SqlClient assemblies and configuration | ||
| section activation. Applications should not instantiate, derive from, or access | ||
| this type directly. | ||
| </para> | ||
| <para>Referencing this handler in an app.config section declaration is supported.</para> | ||
| </remarks> | ||
| </SqlAuthenticationProviderConfigurationSection> | ||
| <Name> | ||
| <summary>The name of the legacy authentication configuration section.</summary> | ||
| </Name> | ||
| <Providers> | ||
| <summary>User-defined auth providers.</summary> | ||
| <value>The collection of user-defined authentication providers.</value> | ||
| </Providers> | ||
| <InitializerType> | ||
| <summary>User-defined initializer.</summary> | ||
| <value>The assembly-qualified initializer type name, or an empty string when unset.</value> | ||
| </InitializerType> | ||
| <ApplicationClientId> | ||
| <summary>Application Client Id</summary> | ||
| <value>The application client ID, or an empty string when unset.</value> | ||
| </ApplicationClientId> | ||
| <UseWamBroker> | ||
| <summary> | ||
| Forwarded to <c>ActiveDirectoryAuthenticationProviderOptions.UseWamBroker</c> | ||
| when the Azure extension's default provider is auto-installed. Stored as a string so | ||
| that an unset attribute can be distinguished from <c>useWamBroker="false"</c>; the | ||
| runtime parses it with <see cref="M:System.Boolean.TryParse(System.String,System.Boolean@)"/>. | ||
| </summary> | ||
| <value>The Web Account Manager broker preference, or an empty string when unset.</value> | ||
| </UseWamBroker> | ||
| </members> | ||
| <members name="SqlClientAuthenticationProviderConfigurationSection"> | ||
| <SqlClientAuthenticationProviderConfigurationSection> | ||
| <summary> | ||
| The configuration section definition for reading app.config. | ||
| This infrastructure type is not intended for direct use by application code. | ||
| </summary> | ||
| <remarks> | ||
| <para>Defines the current <c>SqlClientAuthenticationProviders</c> section for authentication configuration.</para> | ||
| <para> | ||
| This type is public to support use across SqlClient assemblies and configuration | ||
| section activation. Applications should not instantiate, derive from, or access | ||
| this type directly. | ||
| </para> | ||
| <para>Referencing this handler in an app.config section declaration is supported.</para> | ||
| </remarks> | ||
| </SqlClientAuthenticationProviderConfigurationSection> | ||
| <Name> | ||
| <summary>The name of the current authentication configuration section.</summary> | ||
| </Name> | ||
| </members> | ||
| </docs> |
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
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
41 changes: 41 additions & 0 deletions
41
...ta.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProviderConfigurationSection.cs
|
paulmedynski marked this conversation as resolved.
Resolved
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System.ComponentModel; | ||
| using System.Configuration; | ||
|
|
||
| namespace Microsoft.Data.SqlClient | ||
| { | ||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlAuthenticationProviderConfigurationSection"]/SqlAuthenticationProviderConfigurationSection/*'/> | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public class SqlAuthenticationProviderConfigurationSection : ConfigurationSection | ||
| { | ||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlAuthenticationProviderConfigurationSection"]/Name/*'/> | ||
| public const string Name = "SqlAuthenticationProviders"; | ||
|
|
||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlAuthenticationProviderConfigurationSection"]/Providers/*'/> | ||
| [ConfigurationProperty("providers")] | ||
| public ProviderSettingsCollection Providers => (ProviderSettingsCollection)this["providers"]; | ||
|
|
||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlAuthenticationProviderConfigurationSection"]/InitializerType/*'/> | ||
| [ConfigurationProperty("initializerType")] | ||
| public string InitializerType => this["initializerType"] as string ?? string.Empty; | ||
|
|
||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlAuthenticationProviderConfigurationSection"]/ApplicationClientId/*'/> | ||
| [ConfigurationProperty("applicationClientId", IsRequired = false)] | ||
| public string ApplicationClientId => this["applicationClientId"] as string ?? string.Empty; | ||
|
|
||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlAuthenticationProviderConfigurationSection"]/UseWamBroker/*'/> | ||
| [ConfigurationProperty("useWamBroker", IsRequired = false)] | ||
| public string UseWamBroker => this["useWamBroker"] as string ?? string.Empty; | ||
| } | ||
|
|
||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlClientAuthenticationProviderConfigurationSection"]/SqlClientAuthenticationProviderConfigurationSection/*'/> | ||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||
| public class SqlClientAuthenticationProviderConfigurationSection : SqlAuthenticationProviderConfigurationSection | ||
| { | ||
| /// <include file='../doc/SqlAuthenticationProviderConfigurationSection.xml' path='docs/members[@name="SqlClientAuthenticationProviderConfigurationSection"]/Name/*'/> | ||
| public new const string Name = "SqlClientAuthenticationProviders"; | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
...soft.Data.SqlClient.Extensions/Abstractions/test/AuthenticationConfigurationSchemaTest.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System.ComponentModel; | ||
| using System.Configuration; | ||
|
|
||
| namespace Microsoft.Data.SqlClient.Extensions.Abstractions.Test; | ||
|
|
||
| /// <summary>Pins authentication section names, configuration properties and defaults in Abstractions.</summary> | ||
| public class AuthenticationConfigurationSchemaTest | ||
| { | ||
| /// <summary>Both infrastructure-only handlers preserve their schema and remain hidden from IntelliSense.</summary> | ||
| [Theory] | ||
| [InlineData(typeof(SqlAuthenticationProviderConfigurationSection), "SqlAuthenticationProviders")] | ||
| [InlineData(typeof(SqlClientAuthenticationProviderConfigurationSection), "SqlClientAuthenticationProviders")] | ||
| public void HandlerContractIsPreserved(Type type, string sectionName) | ||
| { | ||
| var editorBrowsable = Assert.IsType<EditorBrowsableAttribute>( | ||
| Assert.Single(type.GetCustomAttributes(typeof(EditorBrowsableAttribute), inherit: false))); | ||
| Assert.Equal(EditorBrowsableState.Never, editorBrowsable.State); | ||
| var section = Assert.IsAssignableFrom<ConfigurationSection>(Activator.CreateInstance(type)); | ||
| Assert.Equal(new[] { "applicationClientId", "initializerType", "providers", "useWamBroker" }, | ||
| section.ElementInformation.Properties.Cast<PropertyInformation>() | ||
| .Select(property => property.Name).OrderBy(name => name, StringComparer.Ordinal)); | ||
| Assert.IsType<ProviderSettingsCollection>(section.ElementInformation.Properties["providers"].Value); | ||
| Assert.Equal(sectionName, type.GetField("Name")!.GetRawConstantValue()); | ||
| Assert.Equal(string.Empty, section.ElementInformation.Properties["initializerType"].Value); | ||
| Assert.Equal(string.Empty, section.ElementInformation.Properties["applicationClientId"].Value); | ||
| Assert.Equal(string.Empty, section.ElementInformation.Properties["useWamBroker"].Value); | ||
| } | ||
| } |
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.