diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-06-04 21:05:47 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-06-04 21:13:00 +0200 |
| commit | cf9597de850de1ef721a35ad79ac67b9fdb9e1d4 (patch) | |
| tree | 4805de53a24bedd91238d6d306476b1921ccc0ad /server/src/Utilities/GithubAuthenticationHelpers.cs | |
| parent | fdbeffe78e5cd7393d28915189ec518a06b941f1 (diff) | |
| download | greatoffice-cf9597de850de1ef721a35ad79ac67b9fdb9e1d4.tar.xz greatoffice-cf9597de850de1ef721a35ad79ac67b9fdb9e1d4.zip | |
refactor: Use Vault to get configuration
Diffstat (limited to 'server/src/Utilities/GithubAuthenticationHelpers.cs')
| -rw-r--r-- | server/src/Utilities/GithubAuthenticationHelpers.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/src/Utilities/GithubAuthenticationHelpers.cs b/server/src/Utilities/GithubAuthenticationHelpers.cs index cf0cabb..f924ecc 100644 --- a/server/src/Utilities/GithubAuthenticationHelpers.cs +++ b/server/src/Utilities/GithubAuthenticationHelpers.cs @@ -1,11 +1,12 @@ using Microsoft.AspNetCore.Authentication.OAuth; +using Microsoft.Extensions.Options; using Npgsql; namespace IOL.GreatOffice.Api.Utilities; public static class GithubAuthenticationHelpers { - public static async Task HandleGithubTicketCreation(OAuthCreatingTicketContext context, IConfiguration configuration) { + public static async Task HandleGithubTicketCreation(OAuthCreatingTicketContext context, IConfiguration configuration, AppConfiguration options) { var githubId = context.Identity?.FindFirst(p => p.Type == ClaimTypes.NameIdentifier)?.Value; var githubUsername = context.Identity?.FindFirst(p => p.Type == ClaimTypes.Name)?.Value; var githubEmail = context.Identity?.FindFirst(p => p.Type == ClaimTypes.Email)?.Value; @@ -19,7 +20,7 @@ public static class GithubAuthenticationHelpers context.Identity.RemoveClaim(claim); } - var connstring = configuration.GetAppDatabaseConnectionString(); + var connstring = configuration.GetAppDatabaseConnectionString(options); var connection = new NpgsqlConnection(connstring); Log.Information($"Getting user mappings for github user: {githubId}"); @@ -57,7 +58,7 @@ public static class GithubAuthenticationHelpers await insertUserCommand.ExecuteNonQueryAsync(); await connection.CloseAsync(); - var refreshTokenEncryptionKey = configuration.GetValue<string>(AppEnvironmentVariables.APP_AES_KEY); + var refreshTokenEncryptionKey = options.APP_AES_KEY; string insertMappingQuery; if (context.RefreshToken.HasValue() && refreshTokenEncryptionKey.HasValue()) { |
