aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers/UserTestController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-02-14 23:05:04 +0800
committercrupest <crupest@outlook.com>2019-02-14 23:05:04 +0800
commit7024bc9666e62cc33f651e7a060235d17bd51f25 (patch)
treeb9762a15e83391d8b7b4d76aa76f125557bb0e51 /Timeline/Controllers/UserTestController.cs
parent44645b381ffe399e444444cc0011287d4e09fd7e (diff)
downloadtimeline-7024bc9666e62cc33f651e7a060235d17bd51f25.tar.gz
timeline-7024bc9666e62cc33f651e7a060235d17bd51f25.tar.bz2
timeline-7024bc9666e62cc33f651e7a060235d17bd51f25.zip
Develop user token interface.
Diffstat (limited to 'Timeline/Controllers/UserTestController.cs')
-rw-r--r--Timeline/Controllers/UserTestController.cs34
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();
+ }
+ }
+}