aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Security
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-02-13 17:05:59 -0600
committerGitHub <noreply@github.com>2021-02-13 17:05:59 -0600
commit034eff1ad47a4ac976237d4e13c596ba1404cd2f (patch)
tree8d9650d86237fe511a600ae58016b1ff3de3a389 /src/slskd/Security
parentaec49da74c08865353faae4d97fb4e405ae970e5 (diff)
parent1744c9b2ded05a8a83874864957229a3235fb546 (diff)
downloadslskd-034eff1ad47a4ac976237d4e13c596ba1404cd2f.tar.gz
Merge pull request #40 from slskd/housekeeping
Tidy up
Diffstat (limited to 'src/slskd/Security')
-rw-r--r--src/slskd/Security/PassthroughAuthentication.cs40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/slskd/Security/PassthroughAuthentication.cs b/src/slskd/Security/PassthroughAuthentication.cs
deleted file mode 100644
index 69b94df5..00000000
--- a/src/slskd/Security/PassthroughAuthentication.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace slskd.Security
-{
- using Microsoft.AspNetCore.Authentication;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using System.Security.Principal;
- using System.Text.Encodings.Web;
- using System.Threading.Tasks;
-
- public class PassthroughAuthentication
- {
- public static string AuthenticationScheme { get; } = "Passthrough";
- }
-
- public class PassthroughAuthenticationHandler : AuthenticationHandler<PassthroughAuthenticationOptions>
- {
- public PassthroughAuthenticationHandler(IOptionsMonitor<PassthroughAuthenticationOptions> optionsMonitor, ILoggerFactory logger, UrlEncoder urlEncoder, ISystemClock systemClock)
- : base(optionsMonitor, logger, urlEncoder, systemClock)
- {
- }
-
- protected override Task<AuthenticateResult> HandleAuthenticateAsync()
- {
- var identity = new GenericIdentity(Options.Username);
- var principal = new GenericPrincipal(identity, new[] { "User" });
- var ticket = new AuthenticationTicket(principal , new AuthenticationProperties(), PassthroughAuthentication.AuthenticationScheme);
-
- return Task.FromResult(AuthenticateResult.Success(ticket));
- }
- }
-
- public class PassthroughAuthenticationOptions : AuthenticationSchemeOptions
- {
- public PassthroughAuthenticationOptions()
- {
- }
-
- public string Username { get; set; }
- }
-}