Skip to content

Commit

Permalink
Merge pull request #51 from vrk-kpa/fix/authorization-bearer-token-sp…
Browse files Browse the repository at this point in the history
…elling

Fix Bearer authorization token spelling
  • Loading branch information
dtsiflit authored Jul 16, 2024
2 parents b926a5d + 84d42ef commit ffa909e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/Entities/IssuanceAccessToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ public struct IssuanceAccessToken: Codable, CanExpire {

public extension IssuanceAccessToken {
var authorizationHeader: [String: String] {
["Authorization": "BEARER \(accessToken)"]
["Authorization": "\(TokenType.bearer.rawValue) \(accessToken)"]
}

func dPoPOrBearerAuthorizationHeader(
dpopConstructor: DPoPConstructorType?,
endpoint: URL?
) throws -> [String: String] {
if tokenType == TokenType.bearer {
return ["Authorization": "BEARER \(accessToken)"]
return ["Authorization": "\(TokenType.bearer.rawValue) \(accessToken)"]
} else if let dpopConstructor, tokenType == TokenType.dpop, let endpoint {
return [
"Authorization": "DPoP \(accessToken)",
"DPoP": try dpopConstructor.jwt(endpoint: endpoint, accessToken: accessToken)
"Authorization": "\(TokenType.dpop.rawValue) \(accessToken)",
TokenType.dpop.rawValue: try dpopConstructor.jwt(endpoint: endpoint, accessToken: accessToken)
]
}
return ["Authorization": "BEARER \(accessToken)"]
return ["Authorization": "\(TokenType.bearer.rawValue) \(accessToken)"]
}
}

0 comments on commit ffa909e

Please sign in to comment.