Skip to content
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

AuthenticationOptions.AddScheme() should declare displayName as nullable #25422

Closed
kevinchalet opened this issue Aug 30, 2020 · 7 comments · Fixed by #25480
Closed

AuthenticationOptions.AddScheme() should declare displayName as nullable #25422

kevinchalet opened this issue Aug 30, 2020 · 7 comments · Fixed by #25480
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer
Milestone

Comments

@kevinchalet
Copy link
Contributor

The display name is an optional thing and is typically not set for handlers that are not meant to be publicly listed. As such, the AuthenticationOptions.AddScheme() method should declare the displayName parameter as nullable (string -> string?).

/// <summary>
/// Adds an <see cref="AuthenticationScheme"/>.
/// </summary>
/// <typeparam name="THandler">The <see cref="IAuthenticationHandler"/> responsible for the scheme.</typeparam>
/// <param name="name">The name of the scheme being added.</param>
/// <param name="displayName">The display name for the scheme.</param>
public void AddScheme<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]THandler>(string name, string displayName) where THandler : IAuthenticationHandler
=> AddScheme(name, b =>
{
b.DisplayName = displayName;
b.HandlerType = typeof(THandler);
});

@HaoK @Tratcher

@Tratcher
Copy link
Member

@pranavkm

@Tratcher Tratcher added the area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer label Aug 30, 2020
@blowdart
Copy link
Contributor

To be taken into account in #25310

@kevinchalet
Copy link
Contributor Author

@blowdart is it open to external contributions? Having to use the null-forgiving operator when calling this method is a bit ugly... 😃

@pranavkm
Copy link
Contributor

pranavkm commented Sep 1, 2020

@kevinchalet feel free to send a PR to the release/5.0 branch.

@HaoK
Copy link
Member

HaoK commented Sep 1, 2020

@blowdart this API isn't part of identity, the lowest auth apis had nullable done in 5.0, so something like this should probably be fixed in 5.0

@blowdart
Copy link
Contributor

blowdart commented Sep 1, 2020 via email

@kevinchalet
Copy link
Contributor Author

PR sent: #25480 😄

@Tratcher Tratcher added this to the 5.0.0-rc1 milestone Sep 1, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants