mirror of
https://github.com/bitwarden/server
synced 2025-12-25 04:33:26 +00:00
* Fix typo in error message: 'Unkown' -> 'Unknown' * Fix typos in error message * Fix typo in example text: 'licence' -> 'license' * Fix typo in validation: 'Ooganization' -> 'Organization' * Fix typo in text string: 'compatibilty' -> 'compatibility' * Fix typo: 'ProviderDisllowedOrganizationTypes' -> 'ProviderDisallowedOrganizationTypes' * Fix typo: 'NSubstitueVersion' -> 'NSubstituteVersion' * Fix typo: 'CreateIntialInvite' -> 'CreateInitialInvite' * Fix typo: '_queuryScheme' -> '_queryScheme' * Fix typo: 'GetApplicationCacheServiceBusSubcriptionName' -> 'GetApplicationCacheServiceBusSubscriptionName' * Fix typo: 'metaDataRespository' -> 'metaDataRepository' * Fix typo: 'cipherAttachements' -> 'cipherAttachments' * Fix typo: 'savedEmergencyAccesss' -> 'savedEmergencyAccesses' * Fix typo: 'owerOrgUser' -> 'ownerOrgUser' * Fix typo: 'Organiation' -> 'Organization' * Fix typo: 'extistingUser' -> 'existingUser' * Fix typo: 'availibleAccess' -> 'availableAccess' * Fix typo: 'HasEnouphStorage' -> 'HasEnoughStorage' * Fix typo: 'extistingOrg' -> 'existingOrg' * Fix typo: 'subcriber' -> 'subscriber' * Fix typo: 'availibleCollections' -> 'availableCollections' * Fix typo: 'Succes' -> 'Success' * Fix typo: 'CreateAsync_UpdateWithCollecitons_Works' -> 'CreateAsync_UpdateWithCollections_Works' * Fix typo: 'BadInsallationId' -> 'BadInstallationId' * Fix typo: 'OrgNotFamiles' -> 'OrgNotFamilies' * Revert "Fix typo: 'Organiation' -> 'Organization'" This reverts commit8aadad1c25. * Revert "Fix typos in error message" This reverts commit81d201fc09. --------- Co-authored-by: Daniel James Smith <djsmith@web.de>
30 lines
888 B
C#
30 lines
888 B
C#
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace Bit.Core.Auth.IdentityServer;
|
|
|
|
public static class TokenRetrieval
|
|
{
|
|
private static string _headerScheme = "Bearer ";
|
|
private static string _queryScheme = "access_token";
|
|
private static string _authHeader = "Authorization";
|
|
|
|
public static Func<HttpRequest, string> FromAuthorizationHeaderOrQueryString()
|
|
{
|
|
return (request) =>
|
|
{
|
|
var authorization = request.Headers[_authHeader].FirstOrDefault();
|
|
if (string.IsNullOrWhiteSpace(authorization))
|
|
{
|
|
return request.Query[_queryScheme].FirstOrDefault();
|
|
}
|
|
|
|
if (authorization.StartsWith(_headerScheme, StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return authorization.Substring(_headerScheme.Length).Trim();
|
|
}
|
|
|
|
return null;
|
|
};
|
|
}
|
|
}
|