aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-07-23 19:03:25 +0800
committer杨宇千 <crupest@outlook.com>2019-07-23 19:03:25 +0800
commit58985e8f2a6931029974067b2c1e78963e4508f0 (patch)
tree572a2ae5c65c484718b3bfda68fd8babc56fe6f2 /Timeline/Controllers
parentc84faf2b8f5a55ae170e92ead6516e573a318e65 (diff)
downloadtimeline-58985e8f2a6931029974067b2c1e78963e4508f0.tar.gz
timeline-58985e8f2a6931029974067b2c1e78963e4508f0.tar.bz2
timeline-58985e8f2a6931029974067b2c1e78963e4508f0.zip
Fix bugs and write unit tests.
Diffstat (limited to 'Timeline/Controllers')
-rw-r--r--Timeline/Controllers/UserTestController.cs11
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();
}