File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -269,8 +269,10 @@ public struct CompositeAuthorizationProvider: AuthorizationProvider {
269
269
switch provider {
270
270
case let provider as NetrcAuthorizationProvider :
271
271
ObservabilitySystem . topScope. emit ( info: " Credentials for \( url) found in netrc file at \( provider. path) " )
272
+ #if canImport(Security)
272
273
case is KeychainAuthorizationProvider :
273
274
ObservabilitySystem . topScope. emit ( info: " Credentials for \( url) found in keychain " )
275
+ #endif
274
276
default :
275
277
ObservabilitySystem . topScope. emit ( info: " Credentials for \( url) found in \( provider) " )
276
278
}
Original file line number Diff line number Diff line change @@ -493,8 +493,16 @@ public class SwiftTool {
493
493
}
494
494
495
495
func getAuthorizationProvider( ) throws -> AuthorizationProvider ? {
496
- // currently only single provider: netrc
497
- return try self . getNetrcConfig ( ) ? . get ( )
496
+ var providers = [ AuthorizationProvider] ( )
497
+ // netrc file has higher specificity than keychain so use it first
498
+ if let workspaceNetrc = try self . getNetrcConfig ( ) ? . get ( ) {
499
+ providers. append ( workspaceNetrc)
500
+ }
501
+ #if canImport(Security)
502
+ providers. append ( KeychainAuthorizationProvider ( ) )
503
+ #endif
504
+ return CompositeAuthorizationProvider ( providers)
505
+
498
506
}
499
507
500
508
func getNetrcConfig( ) -> Workspace . Configuration . Netrc ? {
Original file line number Diff line number Diff line change @@ -350,13 +350,7 @@ extension Workspace.Configuration {
350
350
}
351
351
352
352
private static func load( _ path: AbsolutePath , fileSystem: FileSystem ) throws -> AuthorizationProvider {
353
- var providers = [ AuthorizationProvider] ( )
354
- // netrc file has higher specificity than keychain so use it first
355
- providers. append ( try NetrcAuthorizationProvider ( path: path, fileSystem: fileSystem) )
356
- #if canImport(Security)
357
- providers. append ( KeychainAuthorizationProvider ( ) )
358
- #endif
359
- return CompositeAuthorizationProvider ( providers)
353
+ try NetrcAuthorizationProvider ( path: path, fileSystem: fileSystem)
360
354
}
361
355
}
362
356
}
You can’t perform that action at this time.
0 commit comments