diff options
author | crupest <crupest@outlook.com> | 2019-02-14 23:05:04 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-02-14 23:05:04 +0800 |
commit | 3c140656ebe6ed34dda9356a01dbff205651e641 (patch) | |
tree | 8b8ca7331c9510b897042737a5cbbc0f77b1b736 /Timeline/Controllers/UserTestController.cs | |
parent | de90f0413553a23f8ebba1343c6e96c63e0c9748 (diff) | |
download | timeline-3c140656ebe6ed34dda9356a01dbff205651e641.tar.gz timeline-3c140656ebe6ed34dda9356a01dbff205651e641.tar.bz2 timeline-3c140656ebe6ed34dda9356a01dbff205651e641.zip |
Develop user token interface.
Diffstat (limited to 'Timeline/Controllers/UserTestController.cs')
-rw-r--r-- | Timeline/Controllers/UserTestController.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Timeline/Controllers/UserTestController.cs b/Timeline/Controllers/UserTestController.cs new file mode 100644 index 00000000..7fb6850b --- /dev/null +++ b/Timeline/Controllers/UserTestController.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Timeline.Controllers +{ + [Route("api/test/User")] + public class UserTestController : Controller + { + [HttpGet("[action]")] + [Authorize] + public ActionResult NeedAuthorize() + { + return Ok(); + } + + [HttpGet("[action]")] + [Authorize(Roles = "User,Admin")] + public ActionResult BothUserAndAdmin() + { + return Ok(); + } + + [HttpGet("[action]")] + [Authorize(Roles = "Admin")] + public ActionResult OnlyAdmin() + { + return Ok(); + } + } +} |