Feature/Auth: implement user authentication #3
@@ -15,13 +15,13 @@ public class ItemsController : ControllerBase {
|
|||||||
service_ = service;
|
service_ = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous] // accessible if not authorized
|
[[Authorize]]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<List<Item>>> getItems() {
|
public async Task<ActionResult<List<Item>>> getItems() {
|
||||||
return Ok(await service_.GetAll());
|
return Ok(await service_.GetAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[[Authorize]]
|
||||||
[HttpGet("{id:int}")]
|
[HttpGet("{id:int}")]
|
||||||
public async Task<ActionResult<Item>> getItem(int id) {
|
public async Task<ActionResult<Item>> getItem(int id) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user