Skip to content

Commit

Permalink
Add default implementation for AuthTokenProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
royjit committed Apr 18, 2023
1 parent 9572357 commit 97794e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ class IAMAuthInterceptor: AuthInterceptor {
self.region = region
}

func interceptMessage(_ message: AppSyncMessage, for endpoint: URL, completion: @escaping (AppSyncMessage) -> Void) {

}

func interceptConnection(_ request: AppSyncConnectionRequest, for endpoint: URL, completion: @escaping (AppSyncConnectionRequest) -> Void) {

}

func interceptMessage(_ message: AppSyncMessage, for endpoint: URL) -> AppSyncMessage {
switch message.messageType {
case .subscribe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ public protocol AuthTokenProvider {
func getToken(completion: @escaping (Result<String, AuthError>) -> Void)
}

public extension AuthTokenProvider {

func getToken(completion: @escaping (Result<String, AuthError>) -> Void) {
let result = getToken()
completion(result)
}
}

public struct BasicUserPoolTokenProvider: AuthTokenProvider {

let authService: AWSAuthServiceBehavior
Expand Down

0 comments on commit 97794e5

Please sign in to comment.