objc2_foundation/generated/NSURLProtectionSpace.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern "C" {
9 /// The protocol for HTTP
10 ///
11 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspacehttp?language=objc)
12 #[cfg(feature = "NSString")]
13 pub static NSURLProtectionSpaceHTTP: &'static NSString;
14}
15
16extern "C" {
17 /// The protocol for HTTPS
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspacehttps?language=objc)
20 #[cfg(feature = "NSString")]
21 pub static NSURLProtectionSpaceHTTPS: &'static NSString;
22}
23
24extern "C" {
25 /// The protocol for FTP
26 ///
27 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspaceftp?language=objc)
28 #[cfg(feature = "NSString")]
29 pub static NSURLProtectionSpaceFTP: &'static NSString;
30}
31
32extern "C" {
33 /// The proxy type for http proxies
34 ///
35 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspacehttpproxy?language=objc)
36 #[cfg(feature = "NSString")]
37 pub static NSURLProtectionSpaceHTTPProxy: &'static NSString;
38}
39
40extern "C" {
41 /// The proxy type for https proxies
42 ///
43 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspacehttpsproxy?language=objc)
44 #[cfg(feature = "NSString")]
45 pub static NSURLProtectionSpaceHTTPSProxy: &'static NSString;
46}
47
48extern "C" {
49 /// The proxy type for ftp proxies
50 ///
51 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspaceftpproxy?language=objc)
52 #[cfg(feature = "NSString")]
53 pub static NSURLProtectionSpaceFTPProxy: &'static NSString;
54}
55
56extern "C" {
57 /// The proxy type for SOCKS proxies
58 ///
59 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspacesocksproxy?language=objc)
60 #[cfg(feature = "NSString")]
61 pub static NSURLProtectionSpaceSOCKSProxy: &'static NSString;
62}
63
64extern "C" {
65 /// The default authentication method for a protocol
66 ///
67 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethoddefault?language=objc)
68 #[cfg(feature = "NSString")]
69 pub static NSURLAuthenticationMethodDefault: &'static NSString;
70}
71
72extern "C" {
73 /// HTTP basic authentication. Equivalent to
74 /// NSURLAuthenticationMethodDefault for http.
75 ///
76 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodhttpbasic?language=objc)
77 #[cfg(feature = "NSString")]
78 pub static NSURLAuthenticationMethodHTTPBasic: &'static NSString;
79}
80
81extern "C" {
82 /// HTTP digest authentication.
83 ///
84 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodhttpdigest?language=objc)
85 #[cfg(feature = "NSString")]
86 pub static NSURLAuthenticationMethodHTTPDigest: &'static NSString;
87}
88
89extern "C" {
90 /// HTML form authentication. Applies to any protocol.
91 ///
92 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodhtmlform?language=objc)
93 #[cfg(feature = "NSString")]
94 pub static NSURLAuthenticationMethodHTMLForm: &'static NSString;
95}
96
97extern "C" {
98 /// NTLM authentication.
99 ///
100 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodntlm?language=objc)
101 #[cfg(feature = "NSString")]
102 pub static NSURLAuthenticationMethodNTLM: &'static NSString;
103}
104
105extern "C" {
106 /// Negotiate authentication.
107 ///
108 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodnegotiate?language=objc)
109 #[cfg(feature = "NSString")]
110 pub static NSURLAuthenticationMethodNegotiate: &'static NSString;
111}
112
113extern "C" {
114 /// SSL Client certificate. Applies to any protocol.
115 ///
116 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodclientcertificate?language=objc)
117 #[cfg(feature = "NSString")]
118 pub static NSURLAuthenticationMethodClientCertificate: &'static NSString;
119}
120
121extern "C" {
122 /// SecTrustRef validation required. Applies to any protocol.
123 ///
124 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlauthenticationmethodservertrust?language=objc)
125 #[cfg(feature = "NSString")]
126 pub static NSURLAuthenticationMethodServerTrust: &'static NSString;
127}
128
129extern_class!(
130 /// This class represents a protection space requiring authentication.
131 ///
132 /// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlprotectionspace?language=objc)
133 #[unsafe(super(NSObject))]
134 #[derive(Debug, PartialEq, Eq, Hash)]
135 pub struct NSURLProtectionSpace;
136);
137
138unsafe impl Send for NSURLProtectionSpace {}
139
140unsafe impl Sync for NSURLProtectionSpace {}
141
142#[cfg(feature = "NSObject")]
143extern_conformance!(
144 unsafe impl NSCoding for NSURLProtectionSpace {}
145);
146
147#[cfg(feature = "NSObject")]
148extern_conformance!(
149 unsafe impl NSCopying for NSURLProtectionSpace {}
150);
151
152#[cfg(feature = "NSObject")]
153unsafe impl CopyingHelper for NSURLProtectionSpace {
154 type Result = Self;
155}
156
157extern_conformance!(
158 unsafe impl NSObjectProtocol for NSURLProtectionSpace {}
159);
160
161#[cfg(feature = "NSObject")]
162extern_conformance!(
163 unsafe impl NSSecureCoding for NSURLProtectionSpace {}
164);
165
166impl NSURLProtectionSpace {
167 extern_methods!(
168 #[cfg(feature = "NSString")]
169 /// Initialize a protection space representing an origin server, or a realm on one
170 ///
171 /// Parameter `host`: The hostname of the server
172 ///
173 /// Parameter `port`: The port for the server
174 ///
175 /// Parameter `protocol`: The protocol for this server - e.g. "http", "ftp", "https"
176 ///
177 /// Parameter `realm`: A string indicating a protocol-specific subdivision
178 /// of a single host. For http and https, this maps to the realm
179 /// string in http authentication challenges. For many other protocols
180 /// it is unused.
181 ///
182 /// Parameter `authenticationMethod`: The authentication method to use to access this protection space -
183 /// valid values include nil (default method),
184 /// "
185 /// digest" and @"form".
186 ///
187 /// Returns: The initialized object.
188 #[unsafe(method(initWithHost:port:protocol:realm:authenticationMethod:))]
189 #[unsafe(method_family = init)]
190 pub unsafe fn initWithHost_port_protocol_realm_authenticationMethod(
191 this: Allocated<Self>,
192 host: &NSString,
193 port: NSInteger,
194 protocol: Option<&NSString>,
195 realm: Option<&NSString>,
196 authentication_method: Option<&NSString>,
197 ) -> Retained<Self>;
198
199 #[cfg(feature = "NSString")]
200 /// Initialize a protection space representing a proxy server, or a realm on one
201 ///
202 /// Parameter `host`: The hostname of the proxy server
203 ///
204 /// Parameter `port`: The port for the proxy server
205 ///
206 /// Parameter `type`: The type of proxy - e.g. "http", "ftp", "SOCKS"
207 ///
208 /// Parameter `realm`: A string indicating a protocol-specific subdivision
209 /// of a single host. For http and https, this maps to the realm
210 /// string in http authentication challenges. For many other protocols
211 /// it is unused.
212 ///
213 /// Parameter `authenticationMethod`: The authentication method to use to access this protection space -
214 /// valid values include nil (default method) and
215 /// "
216 /// digest"
217 ///
218 /// Returns: The initialized object.
219 #[unsafe(method(initWithProxyHost:port:type:realm:authenticationMethod:))]
220 #[unsafe(method_family = init)]
221 pub unsafe fn initWithProxyHost_port_type_realm_authenticationMethod(
222 this: Allocated<Self>,
223 host: &NSString,
224 port: NSInteger,
225 r#type: Option<&NSString>,
226 realm: Option<&NSString>,
227 authentication_method: Option<&NSString>,
228 ) -> Retained<Self>;
229
230 #[cfg(feature = "NSString")]
231 /// Get the authentication realm for which the protection space that
232 /// needs authentication
233 ///
234 /// This is generally only available for http
235 /// authentication, and may be nil otherwise.
236 ///
237 /// Returns: The realm string
238 #[unsafe(method(realm))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn realm(&self) -> Option<Retained<NSString>>;
241
242 /// Determine if the password for this protection space can be sent securely
243 ///
244 /// Returns: YES if a secure authentication method or protocol will be used, NO otherwise
245 #[unsafe(method(receivesCredentialSecurely))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn receivesCredentialSecurely(&self) -> bool;
248
249 /// Determine if this authenticating protection space is a proxy server
250 ///
251 /// Returns: YES if a proxy, NO otherwise
252 #[unsafe(method(isProxy))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn isProxy(&self) -> bool;
255
256 #[cfg(feature = "NSString")]
257 /// Get the proxy host if this is a proxy authentication, or the host from the URL.
258 ///
259 /// Returns: The host for this protection space.
260 #[unsafe(method(host))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn host(&self) -> Retained<NSString>;
263
264 /// Get the proxy port if this is a proxy authentication, or the port from the URL.
265 ///
266 /// Returns: The port for this protection space, or 0 if not set.
267 #[unsafe(method(port))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn port(&self) -> NSInteger;
270
271 #[cfg(feature = "NSString")]
272 /// Get the type of this protection space, if a proxy
273 ///
274 /// Returns: The type string, or nil if not a proxy.
275 #[unsafe(method(proxyType))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn proxyType(&self) -> Option<Retained<NSString>>;
278
279 #[cfg(feature = "NSString")]
280 /// Get the protocol of this protection space, if not a proxy
281 ///
282 /// Returns: The type string, or nil if a proxy.
283 #[unsafe(method(protocol))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn protocol(&self) -> Option<Retained<NSString>>;
286
287 #[cfg(feature = "NSString")]
288 /// Get the authentication method to be used for this protection space
289 ///
290 /// Returns: The authentication method
291 #[unsafe(method(authenticationMethod))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn authenticationMethod(&self) -> Retained<NSString>;
294 );
295}
296
297/// Methods declared on superclass `NSObject`.
298impl NSURLProtectionSpace {
299 extern_methods!(
300 #[unsafe(method(init))]
301 #[unsafe(method_family = init)]
302 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
303
304 #[unsafe(method(new))]
305 #[unsafe(method_family = new)]
306 pub unsafe fn new() -> Retained<Self>;
307 );
308}
309
310/// NSClientCertificateSpace.
311/// This category supplies additional information for use when a client certificate is required by the server in order to complete authentication.
312impl NSURLProtectionSpace {
313 extern_methods!(
314 #[cfg(all(feature = "NSArray", feature = "NSData"))]
315 /// Returns an array of acceptable certificate issuing authorities for client certification authentication. Issuers are identified by their distinguished name and returned as a DER encoded data.
316 ///
317 /// Returns: An array of NSData objects. (Nil if the authenticationMethod is not NSURLAuthenticationMethodClientCertificate)
318 #[unsafe(method(distinguishedNames))]
319 #[unsafe(method_family = none)]
320 pub unsafe fn distinguishedNames(&self) -> Option<Retained<NSArray<NSData>>>;
321 );
322}
323
324/// NSServerTrustValidationSpace.
325/// This category supplies additional information for use by the client to evaluate whether to trust a given server during a security handshake.
326impl NSURLProtectionSpace {
327 extern_methods!();
328}