DotNetCore 2.1 -> 2.0

Certificate
Kettel instead of IISExpress
This commit is contained in:
2018-10-06 02:05:00 +02:00
parent bb6b5ee4dd
commit a44cd1321a
11 changed files with 57 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ namespace LaDOSE.Api.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
[Produces("application/json")]
public class GameController : ControllerBase
{
@@ -23,7 +23,7 @@ namespace LaDOSE.Api.Controllers
}
// GET api/Config
[HttpGet]
public ActionResult<IEnumerable<Game>> Get()
public List<Game> Get()
{
return _db.Game.ToList();

View File

@@ -9,25 +9,27 @@ using LaDOSE.Api.Services;
using LaDOSE.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
namespace LaDOSE.Api.Controllers
{
[Authorize]
[ApiController]
[Produces("application/json")]
[Route("[controller]")]
public class UsersController : ControllerBase
{
private IUserService _userService;
private readonly IConfiguration _configuration;
public UsersController(
IUserService userService
IUserService userService,
IConfiguration configuration
)
{
_userService = userService;
_configuration = configuration;
}
[AllowAnonymous]
@@ -56,7 +58,7 @@ namespace LaDOSE.Api.Controllers
return BadRequest(new { message = "Username or password is incorrect" });
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes("this is my custom Secret key for authnetication");
var key = Encoding.ASCII.GetBytes(this._configuration["JWTTokenSecret"]);
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new Claim[]