Created
January 23, 2020 16:04
-
-
Save changhuixu/5319ba495f813100136265cdd2991b01 to your computer and use it in GitHub Desktop.
ASP.NET Core basic authentication attribute filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | |
public class BasicAuthAttribute : TypeFilterAttribute | |
{ | |
public BasicAuthAttribute(string realm = @"My Realm") : base(typeof(BasicAuthFilter)) | |
{ | |
Arguments = new object[] { realm }; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile error:
base(typeof(BasicAuthFilter)
The type or namespace name 'BasicAuthFilter' could not be found (are you missing a using directive or an assembly reference?
What reference is needed here?