Add ForbidAsync overload for automatic authentication scheme.

This commit is contained in:
Pranav K 2015-10-29 10:03:07 -07:00
parent e4bf2f3f13
commit f177f0c760
1 changed files with 15 additions and 0 deletions

View File

@ -78,6 +78,13 @@ namespace Microsoft.AspNet.Http.Authentication
return SignInAsync(authenticationScheme, principal, properties: null); return SignInAsync(authenticationScheme, principal, properties: null);
} }
/// <summary>
/// Creates a challenge for the authentication manager with <see cref="ChallengeBehavior.Forbidden"/>.
/// </summary>
/// <returns>A <see cref="Task"/> that represents the asynchronous challenge operation.</returns>
public virtual Task ForbidAsync()
=> ForbidAsync(AutomaticScheme, properties: null);
public virtual Task ForbidAsync(string authenticationScheme) public virtual Task ForbidAsync(string authenticationScheme)
{ {
if (authenticationScheme == null) if (authenticationScheme == null)
@ -99,6 +106,14 @@ namespace Microsoft.AspNet.Http.Authentication
return ChallengeAsync(authenticationScheme, properties, ChallengeBehavior.Forbidden); return ChallengeAsync(authenticationScheme, properties, ChallengeBehavior.Forbidden);
} }
/// <summary>
/// Creates a challenge for the authentication manager with <see cref="ChallengeBehavior.Forbidden"/>.
/// </summary>
/// <param name="properties">Additional arbitrary values which may be used by particular authentication types.</param>
/// <returns>A <see cref="Task"/> that represents the asynchronous challenge operation.</returns>
public virtual Task ForbidAsync(AuthenticationProperties properties)
=> ForbidAsync(AutomaticScheme, properties);
public abstract Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties, ChallengeBehavior behavior); public abstract Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties, ChallengeBehavior behavior);
public abstract Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties); public abstract Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties);