diff --git a/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor b/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor index b09c59cd..bdf60fca 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor @@ -65,7 +65,7 @@ - + diff --git a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/HostedServiceAttribute.cs b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/HostedServiceAttribute.cs index 9cd26dda..16fd4362 100644 --- a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/HostedServiceAttribute.cs +++ b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/HostedServiceAttribute.cs @@ -1,7 +1,4 @@ namespace BUTR.Site.NexusMods.DependencyInjection; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] -public sealed class HostedServiceAttribute : Attribute, IToRegister { } - -[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] -public sealed class HostedServiceAttribute : Attribute, IToRegister { } \ No newline at end of file +public sealed class HostedServiceAttribute : Attribute, IToRegister; \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/ScopedServiceAttribute.cs b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/ScopedServiceAttribute.cs index ce64bd81..24aab985 100644 --- a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/ScopedServiceAttribute.cs +++ b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/ScopedServiceAttribute.cs @@ -1,4 +1,4 @@ namespace BUTR.Site.NexusMods.DependencyInjection; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] -public sealed class ScopedServiceAttribute : Attribute, IToRegister { } \ No newline at end of file +public sealed class ScopedServiceAttribute : Attribute, IToRegister; \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/SingletonServiceAttribute.cs b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/SingletonServiceAttribute.cs index 2b9d3103..bd15819c 100644 --- a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/SingletonServiceAttribute.cs +++ b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/SingletonServiceAttribute.cs @@ -1,7 +1,7 @@ namespace BUTR.Site.NexusMods.DependencyInjection; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] -public sealed class SingletonServiceAttribute : Attribute, IToRegister { } +public sealed class SingletonServiceAttribute : Attribute, IToRegister; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] -public sealed class SingletonServiceAttribute : Attribute, IToRegister { } \ No newline at end of file +public sealed class SingletonServiceAttribute : Attribute, IToRegister; \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/TransientServiceAttribute.cs b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/TransientServiceAttribute.cs index 3fdfbd97..a87cc3ca 100644 --- a/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/TransientServiceAttribute.cs +++ b/src/BUTR.Site.NexusMods.DependencyInjection/Attributes/TransientServiceAttribute.cs @@ -1,4 +1,4 @@ namespace BUTR.Site.NexusMods.DependencyInjection; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] -public sealed class TransientServiceAttribute : Attribute, IToRegister { } \ No newline at end of file +public sealed class TransientServiceAttribute : Attribute, IToRegister; \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.DependencyInjection/Interfaces/IToRegister.cs b/src/BUTR.Site.NexusMods.DependencyInjection/Interfaces/IToRegister.cs index 041ca798..98cad56e 100644 --- a/src/BUTR.Site.NexusMods.DependencyInjection/Interfaces/IToRegister.cs +++ b/src/BUTR.Site.NexusMods.DependencyInjection/Interfaces/IToRegister.cs @@ -1,3 +1,3 @@ namespace BUTR.Site.NexusMods.DependencyInjection; -public interface IToRegister { } \ No newline at end of file +public interface IToRegister; \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.DependencyInjection/SourceGenerator.cs b/src/BUTR.Site.NexusMods.DependencyInjection/SourceGenerator.cs index 7f38c82a..839b74c8 100644 --- a/src/BUTR.Site.NexusMods.DependencyInjection/SourceGenerator.cs +++ b/src/BUTR.Site.NexusMods.DependencyInjection/SourceGenerator.cs @@ -72,7 +72,7 @@ partial void ConfigureServicesPartial(IServiceCollection services) context.AddSource("AutoGeneratedServicesRegistration", SourceText.From(stringBuilder.ToString(), Encoding.UTF8)); } - private IEnumerable GetTypesWithIToRegisterAttributes(Compilation compilation) + private static IEnumerable GetTypesWithIToRegisterAttributes(Compilation compilation) { var allTypes = GetAllTypes(compilation.GlobalNamespace); var types = allTypes.Where(x => @@ -81,7 +81,7 @@ private IEnumerable GetTypesWithIToRegisterAttributes(Compilat return types; } - private IEnumerable GetAllTypes(INamespaceSymbol @namespace) + private static IEnumerable GetAllTypes(INamespaceSymbol @namespace) { foreach (var type in @namespace.GetTypeMembers()) foreach (var nestedType in GetNestedTypes(type)) @@ -92,7 +92,7 @@ private IEnumerable GetAllTypes(INamespaceSymbol @namespace) yield return type; } - private IEnumerable GetNestedTypes(INamedTypeSymbol type) + private static IEnumerable GetNestedTypes(INamedTypeSymbol type) { yield return type; diff --git a/src/BUTR.Site.NexusMods.Server/Controllers/AuthenticationController.cs b/src/BUTR.Site.NexusMods.Server/Controllers/AuthenticationController.cs index cab0453a..a9451106 100644 --- a/src/BUTR.Site.NexusMods.Server/Controllers/AuthenticationController.cs +++ b/src/BUTR.Site.NexusMods.Server/Controllers/AuthenticationController.cs @@ -20,6 +20,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Net.Http.Headers; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -136,7 +137,8 @@ public AuthenticationController( return ApiResult(new JwtTokenResponse(generatedToken.Token, HttpContext.GetProfile(validateResponse, userRole, metadata))); } - var token = Request.Headers["Authorization"].ToString().Replace(ButrNexusModsAuthSchemeConstants.AuthScheme, "").Trim(); + var authenticationHeaderValue = AuthenticationHeaderValue.Parse(Request.Headers.Authorization!); + var token = authenticationHeaderValue.Parameter!; return ApiResult(new JwtTokenResponse(token, HttpContext.GetProfile())); } } \ No newline at end of file