2021-07-12 08:07:16 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2021-07-13 05:35:31 +00:00
|
|
|
using Props.Options;
|
2021-07-12 08:07:16 +00:00
|
|
|
|
2021-07-13 05:35:31 +00:00
|
|
|
namespace Props.Server.Controllers
|
2021-07-12 08:07:16 +00:00
|
|
|
{
|
|
|
|
[ApiController]
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
public class PublicApiSettingsController : ControllerBase
|
|
|
|
{
|
|
|
|
private IConfiguration configuration;
|
|
|
|
public PublicApiSettingsController(IConfiguration configuration)
|
|
|
|
{
|
|
|
|
this.configuration = configuration;
|
|
|
|
}
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
public IActionResult Get() {
|
|
|
|
return Ok(BuildPublicApiSettings());
|
|
|
|
}
|
|
|
|
|
|
|
|
private IReadOnlyDictionary<string, string> BuildPublicApiSettings() {
|
|
|
|
IdentificationOptions identificationOptions = configuration.GetSection(IdentificationOptions.Identification).Get<IdentificationOptions>();
|
|
|
|
return new Dictionary<string,string>() {
|
|
|
|
// Build dictionary containing options client should be aware of.
|
|
|
|
{"RegistrationEnabled", identificationOptions.RegistrationEnabled.ToString()}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|