aboutsummaryrefslogtreecommitdiff
path: root/VNLib.Plugins.Essentials.SocialOauth
diff options
context:
space:
mode:
Diffstat (limited to 'VNLib.Plugins.Essentials.SocialOauth')
-rw-r--r--VNLib.Plugins.Essentials.SocialOauth/ClientAccessTokenState.cs4
-rw-r--r--VNLib.Plugins.Essentials.SocialOauth/Endpoints/GitHubOauth.cs14
-rw-r--r--VNLib.Plugins.Essentials.SocialOauth/SocialOauthBase.cs4
-rw-r--r--VNLib.Plugins.Essentials.SocialOauth/VNLib.Plugins.Essentials.SocialOauth.csproj6
4 files changed, 14 insertions, 14 deletions
diff --git a/VNLib.Plugins.Essentials.SocialOauth/ClientAccessTokenState.cs b/VNLib.Plugins.Essentials.SocialOauth/ClientAccessTokenState.cs
index 4d6f38d..e5de597 100644
--- a/VNLib.Plugins.Essentials.SocialOauth/ClientAccessTokenState.cs
+++ b/VNLib.Plugins.Essentials.SocialOauth/ClientAccessTokenState.cs
@@ -31,8 +31,6 @@ using VNLib.Utils.Memory;
using VNLib.Utils.Memory.Caching;
using VNLib.Plugins.Essentials.Accounts;
-#nullable enable
-
namespace VNLib.Plugins.Essentials.SocialOauth
{
public sealed class OAuthAccessState : IOAuthAccessState, ICacheable, INonce
@@ -68,7 +66,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth
DateTime ICacheable.Expires { get; set; }
bool IEquatable<ICacheable>.Equals(ICacheable? other) => GetHashCode() == other?.GetHashCode();
- public override int GetHashCode() => Token!.GetHashCode();
+ public override int GetHashCode() => Token!.GetHashCode(StringComparison.Ordinal);
void ICacheable.Evicted()
{
Memory.UnsafeZeroMemory(Nonce);
diff --git a/VNLib.Plugins.Essentials.SocialOauth/Endpoints/GitHubOauth.cs b/VNLib.Plugins.Essentials.SocialOauth/Endpoints/GitHubOauth.cs
index 78b4b49..0b4fc0f 100644
--- a/VNLib.Plugins.Essentials.SocialOauth/Endpoints/GitHubOauth.cs
+++ b/VNLib.Plugins.Essentials.SocialOauth/Endpoints/GitHubOauth.cs
@@ -140,7 +140,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
if (!profResponse.IsSuccessful || profResponse.Data == null || profResponse.Data.ID < 100)
{
- Log.Debug("Client attempted a github login but GH responded with status code {code}", profResponse.StatusCode);
+ Log.Debug("Github login data attempt responded with status code {code}", profResponse.StatusCode);
return null;
}
@@ -173,9 +173,11 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
//Capture the first primary email address and make sure its verified
if (email.Primary && email.Verified)
{
- accountData ??= new();
- //store email on current profile
- accountData.EmailAddress = email.Email;
+ accountData = new()
+ {
+ //store email on current profile
+ EmailAddress = email.Email
+ };
goto Continue;
}
}
@@ -184,7 +186,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
}
else
{
- Log.Debug("Client attempted a github login but GH responded with status code {code}", getEmailResponse.StatusCode);
+ Log.Debug("Github account data request failed but GH responded with status code {code}", getEmailResponse.StatusCode);
return null;
}
Continue:
@@ -196,7 +198,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
RestResponse<GithubProfile> profResponse = await client.Resource.ExecuteAsync<GithubProfile>(request, cancellationToken);
if (!profResponse.IsSuccessful || profResponse.Data == null)
{
- Log.Debug("Client attempted a github login but GH responded with status code {code}", profResponse.StatusCode);
+ Log.Debug("Github account data request failed but GH responded with status code {code}", profResponse.StatusCode);
return null;
}
diff --git a/VNLib.Plugins.Essentials.SocialOauth/SocialOauthBase.cs b/VNLib.Plugins.Essentials.SocialOauth/SocialOauthBase.cs
index 72d0d1b..5728992 100644
--- a/VNLib.Plugins.Essentials.SocialOauth/SocialOauthBase.cs
+++ b/VNLib.Plugins.Essentials.SocialOauth/SocialOauthBase.cs
@@ -51,8 +51,6 @@ using VNLib.Plugins.Essentials.Extensions;
using VNLib.Plugins.Extensions.Validation;
using VNLib.Plugins.Essentials.SocialOauth.Validators;
-#nullable enable
-
namespace VNLib.Plugins.Essentials.SocialOauth
{
@@ -91,7 +89,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth
private readonly IValidator<string> NonceValidator;
private readonly IValidator<AccountData> AccountDataValidator;
- public SocialOauthBase()
+ protected SocialOauthBase()
{
ClaimStore = new(StringComparer.OrdinalIgnoreCase);
AuthorizationStore = new(StringComparer.OrdinalIgnoreCase);
diff --git a/VNLib.Plugins.Essentials.SocialOauth/VNLib.Plugins.Essentials.SocialOauth.csproj b/VNLib.Plugins.Essentials.SocialOauth/VNLib.Plugins.Essentials.SocialOauth.csproj
index 0781d78..bbe9185 100644
--- a/VNLib.Plugins.Essentials.SocialOauth/VNLib.Plugins.Essentials.SocialOauth.csproj
+++ b/VNLib.Plugins.Essentials.SocialOauth/VNLib.Plugins.Essentials.SocialOauth.csproj
@@ -7,8 +7,7 @@
<Version>1.0.1.5</Version>
<Copyright>Copyright © 2022 Vaughn Nugent</Copyright>
<PackageProjectUrl>https://www.vaughnnugent.com/resources</PackageProjectUrl>
- <AssemblyName>SocialOauth</AssemblyName>
- <Platforms>AnyCPU;x64</Platforms>
+ <AssemblyName>SocialOauth</AssemblyName>
</PropertyGroup>
<ItemGroup>
@@ -28,6 +27,9 @@
<PropertyGroup>
<!--Enable dynamic loading-->
<EnableDynamicLoading>true</EnableDynamicLoading>
+ <Nullable>enable</Nullable>
+ <GenerateDocumentationFile>False</GenerateDocumentationFile>
+ <AnalysisLevel>latest-all</AnalysisLevel>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\VNLib\Essentials\VNLib.Plugins.Essentials.csproj" />