From 0f78135f5d0bc88e3d009c47aba8971cf00823fe Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Thu, 15 Oct 2015 12:33:01 -0700 Subject: [PATCH] Moving AllowAnonymous attribute from MVC --- .../AllowAnonymousAttribute.cs | 12 ++++++++++++ .../AuthorizationPolicy.cs | 2 +- .../IAllowAnonymous.cs | 9 +++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs create mode 100644 src/Microsoft.AspNet.Authorization/IAllowAnonymous.cs diff --git a/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs b/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs new file mode 100644 index 0000000000..30d0c49444 --- /dev/null +++ b/src/Microsoft.AspNet.Authorization/AllowAnonymousAttribute.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.AspNet.Authorization +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class AllowAnonymousAttribute : Attribute, IAllowAnonymous + { + } +} diff --git a/src/Microsoft.AspNet.Authorization/AuthorizationPolicy.cs b/src/Microsoft.AspNet.Authorization/AuthorizationPolicy.cs index 2d8cf315d4..096caeecd9 100644 --- a/src/Microsoft.AspNet.Authorization/AuthorizationPolicy.cs +++ b/src/Microsoft.AspNet.Authorization/AuthorizationPolicy.cs @@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Authorization return builder.Build(); } - public static AuthorizationPolicy Combine(AuthorizationOptions options, IEnumerable attributes) + public static AuthorizationPolicy Combine(AuthorizationOptions options, IEnumerable attributes) { if (options == null) { diff --git a/src/Microsoft.AspNet.Authorization/IAllowAnonymous.cs b/src/Microsoft.AspNet.Authorization/IAllowAnonymous.cs new file mode 100644 index 0000000000..3ba290a989 --- /dev/null +++ b/src/Microsoft.AspNet.Authorization/IAllowAnonymous.cs @@ -0,0 +1,9 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNet.Authorization +{ + public interface IAllowAnonymous + { + } +}