Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit f177f0c

Browse files
committed
Add ForbidAsync overload for automatic authentication scheme.
1 parent e4bf2f3 commit f177f0c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Microsoft.AspNet.Http.Abstractions/Authentication/AuthenticationManager.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ public virtual Task SignInAsync(string authenticationScheme, ClaimsPrincipal pri
7878
return SignInAsync(authenticationScheme, principal, properties: null);
7979
}
8080

81+
/// <summary>
82+
/// Creates a challenge for the authentication manager with <see cref="ChallengeBehavior.Forbidden"/>.
83+
/// </summary>
84+
/// <returns>A <see cref="Task"/> that represents the asynchronous challenge operation.</returns>
85+
public virtual Task ForbidAsync()
86+
=> ForbidAsync(AutomaticScheme, properties: null);
87+
8188
public virtual Task ForbidAsync(string authenticationScheme)
8289
{
8390
if (authenticationScheme == null)
@@ -99,6 +106,14 @@ public virtual Task ForbidAsync(string authenticationScheme, AuthenticationPrope
99106
return ChallengeAsync(authenticationScheme, properties, ChallengeBehavior.Forbidden);
100107
}
101108

109+
/// <summary>
110+
/// Creates a challenge for the authentication manager with <see cref="ChallengeBehavior.Forbidden"/>.
111+
/// </summary>
112+
/// <param name="properties">Additional arbitrary values which may be used by particular authentication types.</param>
113+
/// <returns>A <see cref="Task"/> that represents the asynchronous challenge operation.</returns>
114+
public virtual Task ForbidAsync(AuthenticationProperties properties)
115+
=> ForbidAsync(AutomaticScheme, properties);
116+
102117
public abstract Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties, ChallengeBehavior behavior);
103118

104119
public abstract Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties);

0 commit comments

Comments
 (0)