diff options
author | 杨宇千 <crupest@outlook.com> | 2019-07-23 19:03:25 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-07-23 19:03:25 +0800 |
commit | cccaf4cfdc1b932882768975f409763c22ed1ee1 (patch) | |
tree | 572a2ae5c65c484718b3bfda68fd8babc56fe6f2 /Timeline/Controllers/UserTestController.cs | |
parent | e34873c8cec905cd38c754d8968e848c9d0db5c2 (diff) | |
download | timeline-cccaf4cfdc1b932882768975f409763c22ed1ee1.tar.gz timeline-cccaf4cfdc1b932882768975f409763c22ed1ee1.tar.bz2 timeline-cccaf4cfdc1b932882768975f409763c22ed1ee1.zip |
Fix bugs and write unit tests.
Diffstat (limited to 'Timeline/Controllers/UserTestController.cs')
-rw-r--r-- | Timeline/Controllers/UserTestController.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Timeline/Controllers/UserTestController.cs b/Timeline/Controllers/UserTestController.cs index f1edb0d5..21686b81 100644 --- a/Timeline/Controllers/UserTestController.cs +++ b/Timeline/Controllers/UserTestController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Timeline.Authenticate; namespace Timeline.Controllers { @@ -8,21 +9,21 @@ namespace Timeline.Controllers { [HttpGet("[action]")] [Authorize] - public ActionResult NeedAuthorize() + public ActionResult Authorize() { return Ok(); } [HttpGet("[action]")] - [Authorize(Roles = "user,admin")] - public ActionResult BothUserAndAdmin() + [UserAuthorize] + public new ActionResult User() { return Ok(); } [HttpGet("[action]")] - [Authorize(Roles = "admin")] - public ActionResult OnlyAdmin() + [AdminAuthorize] + public ActionResult Admin() { return Ok(); } |