Allow auth server to staple a .well-known response via createWithIdentV2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using MareSynchronos.API.Routes;
|
||||
using MareSynchronos.API.Dto;
|
||||
using MareSynchronos.API.Routes;
|
||||
using MareSynchronosAuthService.Services;
|
||||
using MareSynchronosShared;
|
||||
using MareSynchronosShared.Data;
|
||||
@@ -124,6 +125,21 @@ public class JwtController : Controller
|
||||
return Content(token.RawData);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost(MareAuth.Auth_CreateIdentV2)]
|
||||
public async Task<IActionResult> CreateTokenV2(string auth, string charaIdent)
|
||||
{
|
||||
var tokenResponse = await CreateToken(auth, charaIdent);
|
||||
var tokenContent = tokenResponse as ContentResult;
|
||||
if (tokenContent == null)
|
||||
return tokenResponse;
|
||||
return Json(new AuthReplyDto
|
||||
{
|
||||
Token = tokenContent.Content,
|
||||
WellKnown = _configuration.GetValueOrDefault(nameof(AuthServiceConfiguration.WellKnown), string.Empty),
|
||||
});
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost(MareAuth.Auth_Register)]
|
||||
public async Task<IActionResult> Register()
|
||||
|
||||
@@ -13,6 +13,8 @@ public class AuthServiceConfiguration : MareConfigurationBase
|
||||
public int RegisterIpLimit { get; set; } = 3;
|
||||
public int RegisterIpDurationInMinutes { get; set; } = 10;
|
||||
|
||||
public string WellKnown { get; set; } = string.Empty;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
@@ -21,6 +23,7 @@ public class AuthServiceConfiguration : MareConfigurationBase
|
||||
sb.AppendLine($"{nameof(UseGeoIP)} => {UseGeoIP}");
|
||||
sb.AppendLine($"{nameof(RegisterIpLimit)} => {RegisterIpLimit}");
|
||||
sb.AppendLine($"{nameof(RegisterIpDurationInMinutes)} => {RegisterIpDurationInMinutes}");
|
||||
sb.AppendLine($"{nameof(WellKnown)} => {WellKnown}");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user