aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers/UserTestController.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
commitdc8269f1034d155e74ea4807d44c755fb83a7630 (patch)
tree572a2ae5c65c484718b3bfda68fd8babc56fe6f2 /Timeline/Controllers/UserTestController.cs
parentf0a317cc511a4a7b04a701c32881d1e3331f3711 (diff)
parentcccaf4cfdc1b932882768975f409763c22ed1ee1 (diff)
downloadtimeline-dc8269f1034d155e74ea4807d44c755fb83a7630.tar.gz
timeline-dc8269f1034d155e74ea4807d44c755fb83a7630.tar.bz2
timeline-dc8269f1034d155e74ea4807d44c755fb83a7630.zip
Merge pull request #25 from crupest/auth
Refactor a lot, especially authentication.
Diffstat (limited to 'Timeline/Controllers/UserTestController.cs')
-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();
}