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.NSURLCredentialStorage;
|
|
8
|
|
9 import dstep.AvailabilityMacros;
|
|
10 import dstep.foundation.NSDictionary;
|
|
11 import dstep.foundation.NSObject;
|
|
12 import dstep.foundation.NSString;
|
|
13 import dstep.foundation.NSURLCredential;
|
|
14 import dstep.foundation.NSURLCredentialStorageInternal;
|
|
15 import dstep.foundation.NSURLProtectionSpace;
|
|
16 import dstep.objc.bridge.Bridge;
|
|
17 import dstep.objc.objc : id;
|
|
18
|
|
19 import bindings = dstep.foundation.NSURLCredentialStorage_bindings;
|
|
20
|
|
21 const NSString NSURLCredentialStorageChangedNotification;
|
|
22
|
|
23 static this ()
|
|
24 {
|
|
25 NSURLCredentialStorageChangedNotification = new NSString(bindings.NSURLCredentialStorageChangedNotification);
|
|
26 }
|
|
27
|
|
28 class NSURLCredentialStorage : NSObject
|
|
29 {
|
|
30 mixin ObjcWrap;
|
|
31
|
|
32 static NSURLCredentialStorage sharedCredentialStorage ()
|
|
33 {
|
|
34 return invokeObjcSelfClass!(NSURLCredentialStorage, "sharedCredentialStorage"return result is this.objcObject ? this : (result !is null ? new NSURLCredentialStorage(result) : null); }
|
|
35
|
|
36 NSDictionary credentialsForProtectionSpace (NSURLProtectionSpace space)
|
|
37 {
|
|
38 return invokeObjcSelf!(NSDictionary, "credentialsForProtectionSpace:", NSURLProtectionSpace)(space);
|
|
39 }
|
|
40
|
|
41 NSDictionary allCredentials ()
|
|
42 {
|
|
43 return invokeObjcSelf!(NSDictionary, "allCredentials");
|
|
44 }
|
|
45
|
|
46 void setCredential (NSURLCredential credential, NSURLProtectionSpace space)
|
|
47 {
|
|
48 return invokeObjcSelf!(void, "setCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space);
|
|
49 }
|
|
50
|
|
51 void removeCredential (NSURLCredential credential, NSURLProtectionSpace space)
|
|
52 {
|
|
53 return invokeObjcSelf!(void, "removeCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space);
|
|
54 }
|
|
55
|
|
56 NSURLCredential defaultCredentialForProtectionSpace (NSURLProtectionSpace space)
|
|
57 {
|
|
58 return invokeObjcSelf!(NSURLCredential, "defaultCredentialForProtectionSpace:", NSURLProtectionSpace)(space);
|
|
59 }
|
|
60
|
|
61 void setDefaultCredential (NSURLCredential credential, NSURLProtectionSpace space)
|
|
62 {
|
|
63 return invokeObjcSelf!(void, "setDefaultCredential:forProtectionSpace:", NSURLCredential, NSURLProtectionSpace)(credential, space);
|
|
64 }
|
|
65 }
|
|
66
|