Skip to content

Commit b6ae06d

Browse files
committed
SWIFT-636: remove custom credential initializers
These initializers are no longer needed now that we bundle version 1.16.x of libmongoc
1 parent f145d0f commit b6ae06d

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

Sources/MongoSwift/Credential.swift

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,6 @@ internal struct Credential: Decodable, Equatable {
1616
private enum CodingKeys: String, CodingKey {
1717
case username, password, source, mechanism, mechanismProperties = "mechanism_properties"
1818
}
19-
20-
// TODO: SWIFT-636: remove this initializer and the one below it.
21-
internal init(from decoder: Decoder) throws {
22-
let container = try decoder.container(keyedBy: CodingKeys.self)
23-
self.username = try container.decodeIfPresent(String.self, forKey: .username)
24-
self.password = try container.decodeIfPresent(String.self, forKey: .password)
25-
self.source = try container.decodeIfPresent(String.self, forKey: .source)
26-
self.mechanism = try container.decodeIfPresent(AuthMechanism.self, forKey: .mechanism)
27-
28-
// libmongoc does not return the service name if it's the default, but it is contained in the spec test files,
29-
// so filter it out here if it's present.
30-
let properties = try container.decodeIfPresent(Document.self, forKey: .mechanismProperties)
31-
let filteredProperties = properties?.filter { !($0.0 == "SERVICE_NAME" && $0.1 == "mongodb") }
32-
// if SERVICE_NAME was the only key then don't return an empty document.
33-
if filteredProperties?.isEmpty == true {
34-
self.mechanismProperties = nil
35-
} else {
36-
self.mechanismProperties = filteredProperties
37-
}
38-
}
39-
40-
internal init(
41-
username: String?,
42-
password: String?,
43-
source: String?,
44-
mechanism: AuthMechanism?,
45-
mechanismProperties: Document?
46-
) {
47-
self.mechanism = mechanism
48-
self.mechanismProperties = mechanismProperties
49-
self.password = password
50-
self.source = source
51-
self.username = username
52-
}
5319
}
5420

5521
/// Possible authentication mechanisms.

0 commit comments

Comments
 (0)