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")]
143unsafe impl NSCoding for NSURLProtectionSpace {}
144
145#[cfg(feature = "NSObject")]
146unsafe impl NSCopying for NSURLProtectionSpace {}
147
148#[cfg(feature = "NSObject")]
149unsafe impl CopyingHelper for NSURLProtectionSpace {
150 type Result = Self;
151}
152
153unsafe impl NSObjectProtocol for NSURLProtectionSpace {}
154
155#[cfg(feature = "NSObject")]
156unsafe impl NSSecureCoding for NSURLProtectionSpace {}
157
158impl NSURLProtectionSpace {
159 extern_methods!(
160 #[cfg(feature = "NSString")]
161 /// Initialize a protection space representing an origin server, or a realm on one
162 ///
163 /// Parameter `host`: The hostname of the server
164 ///
165 /// Parameter `port`: The port for the server
166 ///
167 /// Parameter `protocol`: The protocol for this server - e.g. "http", "ftp", "https"
168 ///
169 /// Parameter `realm`: A string indicating a protocol-specific subdivision
170 /// of a single host. For http and https, this maps to the realm
171 /// string in http authentication challenges. For many other protocols
172 /// it is unused.
173 ///
174 /// Parameter `authenticationMethod`: The authentication method to use to access this protection space -
175 /// valid values include nil (default method),
176 /// "
177 /// digest" and @"form".
178 ///
179 /// Returns: The initialized object.
180 #[unsafe(method(initWithHost:port:protocol:realm:authenticationMethod:))]
181 #[unsafe(method_family = init)]
182 pub unsafe fn initWithHost_port_protocol_realm_authenticationMethod(
183 this: Allocated<Self>,
184 host: &NSString,
185 port: NSInteger,
186 protocol: Option<&NSString>,
187 realm: Option<&NSString>,
188 authentication_method: Option<&NSString>,
189 ) -> Retained<Self>;
190
191 #[cfg(feature = "NSString")]
192 /// Initialize a protection space representing a proxy server, or a realm on one
193 ///
194 /// Parameter `host`: The hostname of the proxy server
195 ///
196 /// Parameter `port`: The port for the proxy server
197 ///
198 /// Parameter `type`: The type of proxy - e.g. "http", "ftp", "SOCKS"
199 ///
200 /// Parameter `realm`: A string indicating a protocol-specific subdivision
201 /// of a single host. For http and https, this maps to the realm
202 /// string in http authentication challenges. For many other protocols
203 /// it is unused.
204 ///
205 /// Parameter `authenticationMethod`: The authentication method to use to access this protection space -
206 /// valid values include nil (default method) and
207 /// "
208 /// digest"
209 ///
210 /// Returns: The initialized object.
211 #[unsafe(method(initWithProxyHost:port:type:realm:authenticationMethod:))]
212 #[unsafe(method_family = init)]
213 pub unsafe fn initWithProxyHost_port_type_realm_authenticationMethod(
214 this: Allocated<Self>,
215 host: &NSString,
216 port: NSInteger,
217 r#type: Option<&NSString>,
218 realm: Option<&NSString>,
219 authentication_method: Option<&NSString>,
220 ) -> Retained<Self>;
221
222 #[cfg(feature = "NSString")]
223 /// Get the authentication realm for which the protection space that
224 /// needs authentication
225 ///
226 /// This is generally only available for http
227 /// authentication, and may be nil otherwise.
228 ///
229 /// Returns: The realm string
230 #[unsafe(method(realm))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn realm(&self) -> Option<Retained<NSString>>;
233
234 /// Determine if the password for this protection space can be sent securely
235 ///
236 /// Returns: YES if a secure authentication method or protocol will be used, NO otherwise
237 #[unsafe(method(receivesCredentialSecurely))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn receivesCredentialSecurely(&self) -> bool;
240
241 /// Determine if this authenticating protection space is a proxy server
242 ///
243 /// Returns: YES if a proxy, NO otherwise
244 #[unsafe(method(isProxy))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn isProxy(&self) -> bool;
247
248 #[cfg(feature = "NSString")]
249 /// Get the proxy host if this is a proxy authentication, or the host from the URL.
250 ///
251 /// Returns: The host for this protection space.
252 #[unsafe(method(host))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn host(&self) -> Retained<NSString>;
255
256 /// Get the proxy port if this is a proxy authentication, or the port from the URL.
257 ///
258 /// Returns: The port for this protection space, or 0 if not set.
259 #[unsafe(method(port))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn port(&self) -> NSInteger;
262
263 #[cfg(feature = "NSString")]
264 /// Get the type of this protection space, if a proxy
265 ///
266 /// Returns: The type string, or nil if not a proxy.
267 #[unsafe(method(proxyType))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn proxyType(&self) -> Option<Retained<NSString>>;
270
271 #[cfg(feature = "NSString")]
272 /// Get the protocol of this protection space, if not a proxy
273 ///
274 /// Returns: The type string, or nil if a proxy.
275 #[unsafe(method(protocol))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn protocol(&self) -> Option<Retained<NSString>>;
278
279 #[cfg(feature = "NSString")]
280 /// Get the authentication method to be used for this protection space
281 ///
282 /// Returns: The authentication method
283 #[unsafe(method(authenticationMethod))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn authenticationMethod(&self) -> Retained<NSString>;
286 );
287}
288
289/// Methods declared on superclass `NSObject`.
290impl NSURLProtectionSpace {
291 extern_methods!(
292 #[unsafe(method(init))]
293 #[unsafe(method_family = init)]
294 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
295
296 #[unsafe(method(new))]
297 #[unsafe(method_family = new)]
298 pub unsafe fn new() -> Retained<Self>;
299 );
300}
301
302/// NSClientCertificateSpace.
303/// This category supplies additional information for use when a client certificate is required by the server in order to complete authentication.
304impl NSURLProtectionSpace {
305 extern_methods!(
306 #[cfg(all(feature = "NSArray", feature = "NSData"))]
307 /// 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.
308 ///
309 /// Returns: An array of NSData objects. (Nil if the authenticationMethod is not NSURLAuthenticationMethodClientCertificate)
310 #[unsafe(method(distinguishedNames))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn distinguishedNames(&self) -> Option<Retained<NSArray<NSData>>>;
313 );
314}
315
316/// NSServerTrustValidationSpace.
317/// This category supplies additional information for use by the client to evaluate whether to trust a given server during a security handshake.
318impl NSURLProtectionSpace {
319 extern_methods!();
320}