From f177f0c760cd84cbd23553bc84196bd3b8eb0170 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 29 Oct 2015 10:03:07 -0700 Subject: [PATCH] Add ForbidAsync overload for automatic authentication scheme. --- .../Authentication/AuthenticationManager.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Microsoft.AspNet.Http.Abstractions/Authentication/AuthenticationManager.cs b/src/Microsoft.AspNet.Http.Abstractions/Authentication/AuthenticationManager.cs index 497ad3e25d..687e1c7474 100644 --- a/src/Microsoft.AspNet.Http.Abstractions/Authentication/AuthenticationManager.cs +++ b/src/Microsoft.AspNet.Http.Abstractions/Authentication/AuthenticationManager.cs @@ -78,6 +78,13 @@ namespace Microsoft.AspNet.Http.Authentication return SignInAsync(authenticationScheme, principal, properties: null); } + /// + /// Creates a challenge for the authentication manager with . + /// + /// A that represents the asynchronous challenge operation. + public virtual Task ForbidAsync() + => ForbidAsync(AutomaticScheme, properties: null); + public virtual Task ForbidAsync(string authenticationScheme) { if (authenticationScheme == null) @@ -99,6 +106,14 @@ namespace Microsoft.AspNet.Http.Authentication return ChallengeAsync(authenticationScheme, properties, ChallengeBehavior.Forbidden); } + /// + /// Creates a challenge for the authentication manager with . + /// + /// Additional arbitrary values which may be used by particular authentication types. + /// A that represents the asynchronous challenge operation. + public virtual Task ForbidAsync(AuthenticationProperties properties) + => ForbidAsync(AutomaticScheme, properties); + public abstract Task ChallengeAsync(string authenticationScheme, AuthenticationProperties properties, ChallengeBehavior behavior); public abstract Task SignInAsync(string authenticationScheme, ClaimsPrincipal principal, AuthenticationProperties properties);