Skip to content

Commit

Permalink
Require payload to be Sendable
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Oct 18, 2024
1 parent 8023fc5 commit 30fff1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/SotoCognitoAuthentication/Authenticators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public struct CognitoAccessAuthenticator: AsyncBearerAuthenticator {
/// Authenticator for Cognito id tokens. Can use this to extract information from Id Token into Payload struct. The list of standard list of claims found in an id token are
/// detailed in the [OpenID spec] (https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) . Your `Payload` type needs
/// to decode using these tags, plus the AWS specific "cognito:username" tag and any custom tags you have setup for the user pool.
public struct CognitoIdAuthenticator<Payload: Authenticatable & Codable>: AsyncBearerAuthenticator {
public struct CognitoIdAuthenticator<Payload: Authenticatable & Codable & Sendable>: AsyncBearerAuthenticator {
public init() {}

public func authenticate(bearer: BearerAuthorization, for request: Request) async throws {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SotoCognitoAuthentication/Request+Cognito.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public extension Request {
/// helper function that returns if request with bearer token is cognito id authenticated and returns contents in the payload type
/// - returns:
/// The payload contained in the token. See `authenticate<Payload: Codable>(idToken:on:)` for more details
public func authenticateId<Payload: Codable>() async throws -> Payload {
public func authenticateId<Payload: Codable & Sendable>() async throws -> Payload {
guard let bearer = request.headers.bearerAuthorization else {
throw Abort(.unauthorized)
}
Expand Down

0 comments on commit 30fff1d

Please sign in to comment.