Skip to content

Commit 786dce4

Browse files
authored
Merge pull request #1383 from pushkarnk/urlauthenticationchallenge
2 parents 5f5c273 + 9af526e commit 786dce4

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

Foundation/URLAuthenticationChallenge.swift

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ public protocol URLAuthenticationChallengeSender : NSObjectProtocol {
4747
to indicate when it's done.
4848
*/
4949
open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
50+
51+
private let _protectionSpace: URLProtectionSpace
52+
private let _proposedCredential: URLCredential?
53+
private let _previousFailureCount: Int
54+
private let _failureResponse: URLResponse?
55+
private let _error: Error?
56+
private let _sender: URLAuthenticationChallengeSender
5057

5158
static public var supportsSecureCoding: Bool {
5259
return true
@@ -72,7 +79,12 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
7279
@result An authentication challenge initialized with the specified parameters
7380
*/
7481
public init(protectionSpace space: URLProtectionSpace, proposedCredential credential: URLCredential?, previousFailureCount: Int, failureResponse response: URLResponse?, error: Error?, sender: URLAuthenticationChallengeSender) {
75-
NSUnimplemented()
82+
self._protectionSpace = space
83+
self._proposedCredential = credential
84+
self._previousFailureCount = previousFailureCount
85+
self._failureResponse = response
86+
self._error = error
87+
self._sender = sender
7688
}
7789

7890

@@ -85,7 +97,12 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
8597
one type of authentication challenge to look like another type.
8698
*/
8799
public init(authenticationChallenge challenge: URLAuthenticationChallenge, sender: URLAuthenticationChallengeSender) {
88-
NSUnimplemented()
100+
self._protectionSpace = challenge.protectionSpace
101+
self._proposedCredential = challenge.proposedCredential
102+
self._previousFailureCount = challenge.previousFailureCount
103+
self._failureResponse = challenge.failureResponse
104+
self._error = challenge.error
105+
self._sender = sender
89106
}
90107

91108

@@ -96,7 +113,7 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
96113
*/
97114
/*@NSCopying*/ open var protectionSpace: URLProtectionSpace {
98115
get {
99-
NSUnimplemented()
116+
return _protectionSpace
100117
}
101118
}
102119

@@ -115,7 +132,7 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
115132
*/
116133
/*@NSCopying*/ open var proposedCredential: URLCredential? {
117134
get {
118-
NSUnimplemented()
135+
return _proposedCredential
119136
}
120137
}
121138

@@ -127,7 +144,7 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
127144
*/
128145
open var previousFailureCount: Int {
129146
get {
130-
NSUnimplemented()
147+
return _previousFailureCount
131148
}
132149
}
133150

@@ -143,7 +160,7 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
143160
*/
144161
/*@NSCopying*/ open var failureResponse: URLResponse? {
145162
get {
146-
NSUnimplemented()
163+
return _failureResponse
147164
}
148165
}
149166

@@ -158,7 +175,7 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
158175
*/
159176
/*@NSCopying*/ open var error: Error? {
160177
get {
161-
NSUnimplemented()
178+
return _error
162179
}
163180
}
164181

@@ -171,7 +188,7 @@ open class URLAuthenticationChallenge : NSObject, NSSecureCoding {
171188
*/
172189
open var sender: URLAuthenticationChallengeSender? {
173190
get {
174-
NSUnimplemented()
191+
return _sender
175192
}
176193
}
177194
}

0 commit comments

Comments
 (0)