14
|
1 /**
|
|
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
|
|
3 * Authors: Jacob Carlborg
|
|
4 * Version: Initial created: Aug 3, 2009
|
|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
|
|
6 */
|
|
7 module dstep.foundation.NSURLAuthenticationChallenge;
|
|
8
|
|
9 import dstep.AvailabilityMacros;
|
|
10 import dstep.foundation.NSError;
|
|
11 import dstep.foundation.NSObject;
|
|
12 import dstep.foundation.NSURLAuthenticationChallengeInternal;
|
|
13 import dstep.foundation.NSURLCredential;
|
|
14 import dstep.foundation.NSURLProtectionSpace;
|
|
15 import dstep.foundation.NSURLResponse;
|
|
16 import dstep.objc.bridge.Bridge;
|
|
17 import dstep.objc.objc : id;
|
|
18
|
|
19 class NSURLAuthenticationChallenge : NSObject
|
|
20 {
|
|
21 mixin ObjcWrap;
|
|
22
|
|
23 Object initWithProtectionSpace (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender)
|
|
24 {
|
|
25 return invokeObjcSelf!(Object, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(space, credential, previousFailureCount, response, error, sender);
|
|
26 }
|
|
27
|
|
28 this (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender)
|
|
29 {
|
|
30 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
|
|
31 id result = Bridge.invokeObjcMethod!(id, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(objcObject, space, credential, previousFailureCount, response, error, sender);
|
|
32
|
|
33 if (result)
|
|
34 objcObject = ret;
|
|
35
|
|
36 dObject = this;
|
|
37 }
|
|
38
|
|
39 Object initWithAuthenticationChallenge (NSURLAuthenticationChallenge challenge, INSURLAuthenticationChallengeSender sender)
|
|
40 {
|
|
41 return invokeObjcSelf!(Object, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(challenge, sender);
|
|
42 }
|
|
43
|
|
44 this (NSURLAuthenticationChallenge challenge, INSURLAuthenticationChallengeSender sender)
|
|
45 {
|
|
46 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
|
|
47 id result = Bridge.invokeObjcMethod!(id, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(objcObject, challenge, sender);
|
|
48
|
|
49 if (result)
|
|
50 objcObject = ret;
|
|
51
|
|
52 dObject = this;
|
|
53 }
|
|
54
|
|
55 NSURLProtectionSpace protectionSpace ()
|
|
56 {
|
|
57 return invokeObjcSelf!(NSURLProtectionSpace, "protectionSpace");
|
|
58 }
|
|
59
|
|
60 NSURLCredential proposedCredential ()
|
|
61 {
|
|
62 return invokeObjcSelf!(NSURLCredential, "proposedCredential");
|
|
63 }
|
|
64
|
|
65 NSInteger previousFailureCount ()
|
|
66 {
|
|
67 return invokeObjcSelf!(NSInteger, "previousFailureCount");
|
|
68 }
|
|
69
|
|
70 NSURLResponse failureResponse ()
|
|
71 {
|
|
72 return invokeObjcSelf!(NSURLResponse, "failureResponse");
|
|
73 }
|
|
74
|
|
75 NSError error ()
|
|
76 {
|
|
77 return invokeObjcSelf!(NSError, "error");
|
|
78 }
|
|
79
|
|
80 INSURLAuthenticationChallengeSender sender ()
|
|
81 {
|
|
82 return invokeObjcSelf!(INSURLAuthenticationChallengeSender, "sender");
|
|
83 }
|
|
84 }
|
|
85
|
|
86 interface INSURLAuthenticationChallengeSender : INSObject
|
|
87 {
|
|
88 void useCredential (NSURLCredential credential, NSURLAuthenticationChallenge challenge);
|
|
89 void continueWithoutCredentialForAuthenticationChallenge (NSURLAuthenticationChallenge challenge);
|
|
90 void cancelAuthenticationChallenge (NSURLAuthenticationChallenge challenge);
|
|
91 }
|
|
92
|