aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Authenticate/Attribute.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-27 21:47:14 +0800
committerGitHub <noreply@github.com>2019-07-27 21:47:14 +0800
commit590a8c576f17817539505ef2ca50f52e840a61d2 (patch)
tree572a2ae5c65c484718b3bfda68fd8babc56fe6f2 /Timeline/Authenticate/Attribute.cs
parent3de4179449a209646e0e5a967d270f7fa0878c03 (diff)
parent58985e8f2a6931029974067b2c1e78963e4508f0 (diff)
downloadtimeline-590a8c576f17817539505ef2ca50f52e840a61d2.tar.gz
timeline-590a8c576f17817539505ef2ca50f52e840a61d2.tar.bz2
timeline-590a8c576f17817539505ef2ca50f52e840a61d2.zip
Merge pull request #25 from crupest/auth
Refactor a lot, especially authentication.
Diffstat (limited to 'Timeline/Authenticate/Attribute.cs')
-rw-r--r--Timeline/Authenticate/Attribute.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/Timeline/Authenticate/Attribute.cs b/Timeline/Authenticate/Attribute.cs
new file mode 100644
index 00000000..50b2681d
--- /dev/null
+++ b/Timeline/Authenticate/Attribute.cs
@@ -0,0 +1,21 @@
+using Microsoft.AspNetCore.Authorization;
+using Timeline.Models;
+
+namespace Timeline.Authenticate
+{
+ public class AdminAuthorizeAttribute : AuthorizeAttribute
+ {
+ public AdminAuthorizeAttribute()
+ {
+ Roles = UserRoles.Admin;
+ }
+ }
+
+ public class UserAuthorizeAttribute : AuthorizeAttribute
+ {
+ public UserAuthorizeAttribute()
+ {
+ Roles = UserRoles.User;
+ }
+ }
+}