diff --git a/src/Finbuckle.MultiTenant.AspNetCore/Strategies/BasePathStrategy.cs b/src/Finbuckle.MultiTenant.AspNetCore/Strategies/BasePathStrategy.cs index 4846a4b6..fe3dddd5 100644 --- a/src/Finbuckle.MultiTenant.AspNetCore/Strategies/BasePathStrategy.cs +++ b/src/Finbuckle.MultiTenant.AspNetCore/Strategies/BasePathStrategy.cs @@ -11,14 +11,14 @@ public class BasePathStrategy : IMultiTenantStrategy { public Task GetIdentifierAsync(object context) { - if(!(context is HttpContext httpContext)) + if (!(context is HttpContext httpContext)) throw new MultiTenantException(null, new ArgumentException($"\"{nameof(context)}\" type must be of type HttpContext", nameof(context))); var path = httpContext.Request.Path; var pathSegments = - path.Value?.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + path.Value?.Split('/', 2, StringSplitOptions.RemoveEmptyEntries); if (pathSegments is null || pathSegments.Length == 0) return Task.FromResult(null); diff --git a/src/Finbuckle.MultiTenant.AspNetCore/Strategies/RemoteAuthenticationCallbackStrategy.cs b/src/Finbuckle.MultiTenant.AspNetCore/Strategies/RemoteAuthenticationCallbackStrategy.cs index 1ef8ef07..dcb04a18 100644 --- a/src/Finbuckle.MultiTenant.AspNetCore/Strategies/RemoteAuthenticationCallbackStrategy.cs +++ b/src/Finbuckle.MultiTenant.AspNetCore/Strategies/RemoteAuthenticationCallbackStrategy.cs @@ -27,7 +27,7 @@ public RemoteAuthenticationCallbackStrategy(ILogger GetIdentifierAsync(object context) { - if(!(context is HttpContext httpContext)) + if (!(context is HttpContext httpContext)) throw new MultiTenantException(null, new ArgumentException($"\"{nameof(context)}\" type must be of type HttpContext", nameof(context))); @@ -35,7 +35,7 @@ public RemoteAuthenticationCallbackStrategy(ILogger typeof(IAuthenticationRequestHandler).IsAssignableFrom(s.HandlerType))) - // Where(s => s.HandlerType.ImplementsOrInheritsUnboundGeneric(typeof(RemoteAuthenticationHandler<>)))) + // Where(s => s.HandlerType.ImplementsOrInheritsUnboundGeneric(typeof(RemoteAuthenticationHandler<>)))) { // Unfortnately we can't rely on the ShouldHandleAsync method since OpenId Connect handler doesn't use it. // Instead we'll get the paths to check from the options. @@ -77,14 +77,14 @@ public RemoteAuthenticationCallbackStrategy(ILogger i.Key.ToLowerInvariant() == "state").Single().Value; + state = form.Single(i => string.Equals(i.Key, "state", StringComparison.OrdinalIgnoreCase)).Value; } var properties = ((dynamic)options).StateDataFormat.Unprotect(state) as AuthenticationProperties; if (properties == null) { - if(logger != null) + if (logger != null) logger.LogWarning("A tenant could not be determined because no state paraameter passed with the remote authentication callback."); return null; }