@@ -13,20 +13,29 @@ class AWSAuthFetchSessionTask: AuthFetchSessionTask, DefaultLogger {
1313 private let authStateMachine : AuthStateMachine
1414 private let fetchAuthSessionHelper : FetchAuthSessionOperationHelper
1515 private let taskHelper : AWSAuthTaskHelper
16+ private let configuration : AuthConfiguration
17+ private let forceReconfigure : Bool
1618
1719 var eventName : HubPayloadEventName {
1820 HubPayload . EventName. Auth. fetchSessionAPI
1921 }
2022
21- init ( _ request: AuthFetchSessionRequest , authStateMachine: AuthStateMachine ) {
23+ init ( _ request: AuthFetchSessionRequest , authStateMachine: AuthStateMachine , configuration : AuthConfiguration , forceReconfigure : Bool = false ) {
2224 self . request = request
2325 self . authStateMachine = authStateMachine
2426 self . fetchAuthSessionHelper = FetchAuthSessionOperationHelper ( )
2527 self . taskHelper = AWSAuthTaskHelper ( authStateMachine: authStateMachine)
28+ self . configuration = configuration
29+ self . forceReconfigure = forceReconfigure
2630 }
2731
2832 func execute( ) async throws -> AuthSession {
2933 log. verbose ( " Starting execution " )
34+ if forceReconfigure {
35+ log. verbose ( " Reconfiguring auth state machine for keychain sharing " )
36+ let event = AuthEvent ( eventType: . reconfigure( configuration) )
37+ await authStateMachine. send ( event)
38+ }
3039 await taskHelper. didStateMachineConfigured ( )
3140 let doesNeedForceRefresh = request. options. forceRefresh
3241 return try await fetchAuthSessionHelper. fetch ( authStateMachine,
0 commit comments