Require api key for user authentication
This commit is contained in:
parent
8718d81f7a
commit
f6962fac3a
1 changed files with 2 additions and 1 deletions
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Robware.Api.Auth.Models;
|
using Robware.Api.Auth.Models;
|
||||||
using Robware.Auth;
|
|
||||||
using Robware.Auth.Users;
|
using Robware.Auth.Users;
|
||||||
|
|
||||||
namespace Robware.Api.Auth.Controllers {
|
namespace Robware.Api.Auth.Controllers {
|
||||||
|
@ -19,6 +19,7 @@ namespace Robware.Api.Auth.Controllers {
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost(nameof(Authenticate))]
|
[HttpPost(nameof(Authenticate))]
|
||||||
|
[Authorize]
|
||||||
public async Task<ActionResult<User>> Authenticate(LoginRequest request) {
|
public async Task<ActionResult<User>> Authenticate(LoginRequest request) {
|
||||||
var (result, user) = await _authenticator.Authenticate(request.Username, request.Password);
|
var (result, user) = await _authenticator.Authenticate(request.Username, request.Password);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue