1/*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef DO_NO_IMPORTS
27import "oaidl.idl";
28import "ocidl.idl";
29import "IWebError.idl";
30import "IWebURLResponse.idl";
31#endif
32
33interface IWebError;
34interface IWebURLAuthenticationChallengeSender;
35interface IWebURLCredential;
36interface IWebURLProtectionSpace;
37interface IWebURLResponse;
38
39typedef enum {
40    WebURLCredentialPersistenceNone,
41    WebURLCredentialPersistenceForSession,
42    WebURLCredentialPersistencePermanent
43} WebURLCredentialPersistence;
44
45[
46    object,
47    oleautomation,
48    uuid(5382DABA-C3C3-40c5-AA40-04079F11A844),
49    pointer_default(unique)
50]
51interface IWebURLAuthenticationChallenge : IUnknown
52{
53    /*
54        - (NSError *)error
55    */
56    HRESULT error([out, retval] IWebError** result);
57
58    /*
59        - (NSURLResponse *)failureResponse
60    */
61    HRESULT failureResponse([out, retval] IWebURLResponse** result);
62
63    /*
64        - (id)initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge sender:(id<NSURLAuthenticationChallengeSender>)sender
65    */
66    HRESULT initWithAuthenticationChallenge([in] IWebURLAuthenticationChallenge* challenge, [in] IWebURLAuthenticationChallengeSender* sender);
67
68    /*
69        - (id)initWithProtectionSpace:(NSURLProtectionSpace *)space proposedCredential:(NSURLCredential *)credential previousFailureCount:(int)count failureResponse:(NSURLResponse *)response error:(NSError *)error sender:(id <NSURLAuthenticationChallengeSender>)sender
70    */
71    HRESULT initWithProtectionSpace([in] IWebURLProtectionSpace* space, [in] IWebURLCredential* proposedCredential, [in] int previousFailureCount, [in] IWebURLResponse* failureResponse, [in] IWebError* error, [in] IWebURLAuthenticationChallengeSender* sender);
72
73    /*
74        -(unsigned)previousFailureCount
75    */
76    HRESULT previousFailureCount([out, retval] UINT* result);
77
78    /*
79        -(NSURLCredential *)proposedCredential
80    */
81    HRESULT proposedCredential([out, retval] IWebURLCredential** result);
82
83    /*
84        - (NSURLProtectionSpace *)protectionSpace
85    */
86    HRESULT protectionSpace([out, retval] IWebURLProtectionSpace** result);
87
88    /*
89        - (id<NSURLAuthenticationChallengeSender>)sender
90    */
91    HRESULT sender([out, retval] IWebURLAuthenticationChallengeSender** sender);
92}
93
94[
95    object,
96    oleautomation,
97    uuid(9360D6FB-186C-4ff7-AE57-D1B973DA0D1C),
98    pointer_default(unique)
99]
100interface IWebURLAuthenticationChallengeSender : IUnknown
101{
102    /*
103        - (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
104    */
105    HRESULT cancelAuthenticationChallenge([in] IWebURLAuthenticationChallenge* challenge);
106
107    /*
108        - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
109    */
110    HRESULT continueWithoutCredentialForAuthenticationChallenge([in] IWebURLAuthenticationChallenge* challenge);
111
112    /*
113        - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
114    */
115    HRESULT useCredential([in] IWebURLCredential* credential, [in] IWebURLAuthenticationChallenge* challenge);
116}
117
118cpp_quote("#define WebURLProtectionSpaceHTTP TEXT(\"http\")")
119cpp_quote("#define WebURLProtectionSpaceHTTPS TEXT(\"https\")")
120cpp_quote("#define WebURLProtectionSpaceFTP TEXT(\"ftp\")")
121cpp_quote("#define WebURLProtectionSpaceFTPS TEXT(\"ftps\")")
122cpp_quote("#define WebURLProtectionSpaceHTTPProxy TEXT(\"http\")")
123cpp_quote("#define WebURLProtectionSpaceHTTPSProxy TEXT(\"https\")")
124cpp_quote("#define WebURLProtectionSpaceFTPProxy TEXT(\"ftp\")")
125cpp_quote("#define WebURLProtectionSpaceSOCKSProxy TEXT(\"SOCKS\")")
126cpp_quote("#define WebURLAuthenticationMethodDefault TEXT(\"WebURLAuthenticationMethodDefault\")")
127cpp_quote("#define WebURLAuthenticationMethodHTTPBasic TEXT(\"WebURLAuthenticationMethodHTTPBasic\")")
128cpp_quote("#define WebURLAuthenticationMethodHTTPDigest TEXT(\"WebURLAuthenticationMethodHTTPDigest\")")
129cpp_quote("#define WebURLAuthenticationMethodHTMLForm TEXT(\"WebURLAuthenticationMethodHTMLForm\")")
130
131[
132    object,
133    oleautomation,
134    hidden,
135    uuid(71D2622A-3FF2-404b-BD45-C60659C901AF),
136    pointer_default(unique)
137]
138interface IWebURLProtectionSpace : IUnknown
139{
140    /*
141        -(NSString *)authenticationMethod
142    */
143    HRESULT authenticationMethod([out, retval] BSTR* result);
144
145    /*
146        -(NSString *)host
147    */
148    HRESULT host([out, retval] BSTR* result);
149
150    /*
151        -(id)initWithHost:(NSString *)host port:(int)port protocol:(NSString *)protocol realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod
152    */
153    HRESULT initWithHost([in] BSTR host, [in] int port, [in] BSTR protocol, [in] BSTR realm, [in] BSTR authenticationMethod);
154
155    /*
156        -(id)initWithProxyHost:(NSString *)host port:(int)port type:(NSString *)proxyType realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod
157    */
158    HRESULT initWithProxyHost([in] BSTR host, [in] int port, [in] BSTR proxyType, [in] BSTR realm, [in] BSTR authenticationMethod);
159
160    /*
161        -(BOOL)isProxy
162    */
163    HRESULT isProxy([out, retval] BOOL* result);
164
165    /*
166        -(int)port
167    */
168    HRESULT port([out, retval] int* result);
169
170    /*
171        -(NSString *)protocol
172    */
173    HRESULT protocol([out, retval] BSTR* result);
174
175    /*
176        -(NSString *)proxyType
177    */
178    HRESULT proxyType([out, retval] BSTR* result);
179
180    /*
181        -(NSString *)realm
182    */
183    HRESULT realm([out, retval] BSTR* result);
184
185    /*
186        -(BOOL)receivesCredentialSecurely
187    */
188    HRESULT receivesCredentialSecurely([out, retval] BOOL* result);
189}
190
191[
192    object,
193    oleautomation,
194    hidden,
195    uuid(A1E9D765-FACE-4189-BBE3-AED7EBF65EBD),
196    pointer_default(unique)
197]
198interface IWebURLCredential : IUnknown
199{
200    /*
201        -(BOOL)hasPassword
202    */
203    HRESULT hasPassword([out, retval] BOOL* result);
204
205    /*
206        -(id)initWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence
207    */
208    HRESULT initWithUser([in] BSTR user, [in] BSTR password, [in] WebURLCredentialPersistence persistence);
209
210    /*
211        -(NSString *)password
212    */
213    HRESULT password([out, retval] BSTR* password);
214
215    /*
216        -(NSURLCredentialPersistence)persistence
217    */
218    HRESULT persistence([out, retval] WebURLCredentialPersistence* result);
219
220    /*
221        -(NSString *)user
222    */
223    HRESULT user([out, retval] BSTR* result);
224}
225