mirror of
https://github.com/bitwarden/server
synced 2026-01-05 10:03:23 +00:00
Turn on file scoped namespaces (#2225)
This commit is contained in:
@@ -1,30 +1,29 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Bit.Core.IdentityServer
|
||||
namespace Bit.Core.IdentityServer;
|
||||
|
||||
public static class TokenRetrieval
|
||||
{
|
||||
public static class TokenRetrieval
|
||||
private static string _headerScheme = "Bearer ";
|
||||
private static string _queuryScheme = "access_token";
|
||||
private static string _authHeader = "Authorization";
|
||||
|
||||
public static Func<HttpRequest, string> FromAuthorizationHeaderOrQueryString()
|
||||
{
|
||||
private static string _headerScheme = "Bearer ";
|
||||
private static string _queuryScheme = "access_token";
|
||||
private static string _authHeader = "Authorization";
|
||||
|
||||
public static Func<HttpRequest, string> FromAuthorizationHeaderOrQueryString()
|
||||
return (request) =>
|
||||
{
|
||||
return (request) =>
|
||||
var authorization = request.Headers[_authHeader].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(authorization))
|
||||
{
|
||||
var authorization = request.Headers[_authHeader].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(authorization))
|
||||
{
|
||||
return request.Query[_queuryScheme].FirstOrDefault();
|
||||
}
|
||||
return request.Query[_queuryScheme].FirstOrDefault();
|
||||
}
|
||||
|
||||
if (authorization.StartsWith(_headerScheme, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return authorization.Substring(_headerScheme.Length).Trim();
|
||||
}
|
||||
if (authorization.StartsWith(_headerScheme, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return authorization.Substring(_headerScheme.Length).Trim();
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user