Swagger-ui works
This commit is contained in:
@@ -5,17 +5,13 @@ using Gameboard.ShogiUI.Sockets.ServiceModels.Socket;
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Types;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets.Controllers
|
||||
{
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
[Authorize(Roles = "Shogi")]
|
||||
[Authorize]
|
||||
public class GameController : ControllerBase
|
||||
{
|
||||
private readonly IGameboardManager gameboardManager;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Gameboard.ShogiUI.Sockets.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
[Authorize(Roles = "Shogi")]
|
||||
[Authorize]
|
||||
public class SocketController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<SocketController> logger;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Identity.Web" Version="1.21.1" />
|
||||
<PackageReference Include="Microsoft.Identity.Web" Version="1.24.1" />
|
||||
<PackageReference Include="Microsoft.Identity.Web.UI" Version="1.16.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using Gameboard.ShogiUI.Sockets.ServiceModels.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DomainWhichPiece = Shogi.Domain.WhichPiece;
|
||||
using DomainWhichPlayer = Shogi.Domain.WhichPlayer;
|
||||
|
||||
|
||||
@@ -8,15 +8,12 @@ using Gameboard.ShogiUI.Sockets.Services.RequestValidators;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpLogging;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Identity.Web;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets
|
||||
@@ -43,7 +40,8 @@ namespace Gameboard.ShogiUI.Sockets
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
options.OAuthConfigObject.ClientId = builder.Configuration["AzureAd:ClientId"];
|
||||
options.OAuthScopes("api://c1e94676-cab0-42ba-8b6c-9532b8486fff/DefaultScope");
|
||||
options.OAuthConfigObject.ClientId = builder.Configuration["AzureAd:SwaggerUIClientId"];
|
||||
options.OAuthConfigObject.UsePkceWithAuthorizationCodeGrant = true;
|
||||
});
|
||||
app.UseHttpsRedirection(); // Apache handles HTTPS in production.
|
||||
@@ -194,6 +192,10 @@ namespace Gameboard.ShogiUI.Sockets
|
||||
{
|
||||
AuthorizationUrl = new Uri("https://login.microsoftonline.com/common/oauth2/v2.0/authorize"),
|
||||
TokenUrl = new Uri("https://login.microsoftonline.com/common/oauth2/v2.0/token"),
|
||||
Scopes = new Dictionary<string, string>
|
||||
{
|
||||
{ "api://c1e94676-cab0-42ba-8b6c-9532b8486fff/DefaultScope", "Default Scope" }
|
||||
}
|
||||
}
|
||||
},
|
||||
Scheme = "Bearer",
|
||||
|
||||
@@ -14,20 +14,9 @@
|
||||
},
|
||||
"AzureAd": {
|
||||
"Instance": "https://login.microsoftonline.com/",
|
||||
"Domain": "Hauthlive.onmicrosoft.com",
|
||||
"TenantId": "d6019544-c403-415c-8e96-50009635b6aa",
|
||||
"TenantId": "common",
|
||||
"ClientId": "c1e94676-cab0-42ba-8b6c-9532b8486fff",
|
||||
"Scopes": "",
|
||||
"CallbackPath": "/signin-oidc"
|
||||
},
|
||||
"AzureAd2": {
|
||||
"Instance": "https://login.microsoftonline.com/",
|
||||
"ClientId": "c1e94676-cab0-42ba-8b6c-9532b8486fff",
|
||||
"TenantId": "d6019544-c403-415c-8e96-50009635b6aa",
|
||||
"Audience": "c1e94676-cab0-42ba-8b6c-9532b8486fff",
|
||||
"ClientSecret": "",
|
||||
"Domain": "Hauthlive.onmicrosoft.com",
|
||||
"CallbackPath": "/signin-oidc"
|
||||
"SwaggerUIClientId": "26bf69a4-2af8-4711-bf5b-79f75e20b082"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Reference in New Issue
Block a user