-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34feaf6
commit e9ae390
Showing
4 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Korga.Configuration; | ||
using Korga.Models.Json; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Korga.Controllers; | ||
|
||
[ApiController] | ||
public class SettingsController : ControllerBase | ||
{ | ||
private readonly IOptions<OpenIdConnectOptions> options; | ||
|
||
public SettingsController(IOptions<OpenIdConnectOptions> options) | ||
{ | ||
this.options = options; | ||
} | ||
|
||
[HttpGet("~/api/settings")] | ||
[ProducesResponseType(typeof(SettingsResponse), StatusCodes.Status200OK)] | ||
public IActionResult Index() | ||
{ | ||
if (options.Value.Authority == null || options.Value.ClientId == null || options.Value.RedirectUri == null) | ||
return StatusCode(StatusCodes.Status500InternalServerError); | ||
|
||
return new JsonResult(new SettingsResponse | ||
{ | ||
OidcAuthority = options.Value.Authority, | ||
OidcClientId = options.Value.ClientId, | ||
OidcRedirectUri = options.Value.RedirectUri, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Korga.Models.Json; | ||
|
||
public class SettingsResponse | ||
{ | ||
public required string OidcAuthority { get; init; } | ||
public required string OidcClientId { get; init; } | ||
public required string OidcRedirectUri { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters