diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-01-23 14:14:54 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-01-23 14:14:54 -0600 |
| commit | cfbf06093202a868fe3c9e5fe26cd17e37e2e295 (patch) | |
| tree | ec8d988581c179cc829d1694d9c79234d70a0a86 /src/slskd/Controllers/SessionController.cs | |
| parent | ec8711a5da5af98a81bd276bd8034a8ddce11332 (diff) | |
| download | slskd-cfbf06093202a868fe3c9e5fe26cd17e37e2e295.tar.gz | |
refactor options
Diffstat (limited to 'src/slskd/Controllers/SessionController.cs')
| -rw-r--r-- | src/slskd/Controllers/SessionController.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/slskd/Controllers/SessionController.cs b/src/slskd/Controllers/SessionController.cs index d41a9295..82155511 100644 --- a/src/slskd/Controllers/SessionController.cs +++ b/src/slskd/Controllers/SessionController.cs @@ -10,6 +10,7 @@ using slskd.DTO; using Microsoft.Extensions.Options; using System.Linq; + using slskd; /// <summary> /// Session @@ -21,13 +22,13 @@ [Consumes("application/json")] public class SessionController : ControllerBase { - private IOptionsSnapshot<RuntimeOptions.Soulseek> SoulseekOptions { get; set; } - private IOptionsSnapshot<RuntimeOptions.Authentication> AuthenticationOptions { get; set; } + private IOptionsSnapshot<slskd.Configuration.Soulseek> SoulseekOptions { get; set; } + private IOptionsSnapshot<slskd.Configuration.Authentication> AuthenticationOptions { get; set; } private SymmetricSecurityKey JwtSigningKey { get; set; } public SessionController( - IOptionsSnapshot<RuntimeOptions.Soulseek> soulseekOptions, - IOptionsSnapshot<RuntimeOptions.Authentication> authenticationOptions, + IOptionsSnapshot<slskd.Configuration.Soulseek> soulseekOptions, + IOptionsSnapshot<slskd.Configuration.Authentication> authenticationOptions, SymmetricSecurityKey jwtSigningKey) { SoulseekOptions = soulseekOptions; @@ -46,7 +47,7 @@ [ProducesResponseType(typeof(bool), 200)] public IActionResult Enabled() { - return Ok(!InstanceOptions.DisableAuthentication); + return base.Ok((object)!Program.Options.NoAuth); } /// <summary> @@ -115,7 +116,7 @@ private JwtSecurityToken GetJwtSecurityToken(string username, Role role) { var issuedUtc = DateTime.UtcNow; - var expiresUtc = DateTime.UtcNow.AddMilliseconds(InstanceOptions.JwtTTL); + var expiresUtc = DateTime.UtcNow.AddMilliseconds((double)Program.Options.Web.Jwt.TTL); var claims = new List<Claim>() { |
