1 /* Interface for NSURLProtectionSpace for GNUstep 2 Copyright (C) 2006 Software Foundation, Inc. 3 4 Written by: Richard Frith-Macdonald <frm@gnu.org> 5 Date: 2006 6 7 This file is part of the GNUstep Base Library. 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public 20 License along with this library; if not, write to the Free 21 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 Boston, MA 02110 USA. 23 */ 24 25 #ifndef __NSURLProtectionSpace_h_GNUSTEP_BASE_INCLUDE 26 #define __NSURLProtectionSpace_h_GNUSTEP_BASE_INCLUDE 27 #import <GNUstepBase/GSVersionMacros.h> 28 29 #if OS_API_VERSION(MAC_OS_X_VERSION_10_2,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) 30 31 #import <Foundation/NSObject.h> 32 33 #if defined(__cplusplus) 34 extern "C" { 35 #endif 36 37 @class NSString; 38 39 extern NSString * const NSURLProtectionSpaceFTPProxy; /** An FTP proxy */ 40 extern NSString * const NSURLProtectionSpaceHTTPProxy; /** An HTTP proxy */ 41 extern NSString * const NSURLProtectionSpaceHTTPSProxy; /** An HTTPS proxy */ 42 extern NSString * const NSURLProtectionSpaceSOCKSProxy; /** A SOCKS proxy */ 43 44 /** Default authentication (Basic) */ 45 extern NSString * const NSURLAuthenticationMethodDefault; 46 47 /** HTML form authentication */ 48 extern NSString * const NSURLAuthenticationMethodHTMLForm; 49 50 /** HTTP Basic authentication */ 51 extern NSString * const NSURLAuthenticationMethodHTTPBasic; 52 53 /** HTTP Digest authentication */ 54 extern NSString * const NSURLAuthenticationMethodHTTPDigest; 55 56 #if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) 57 extern NSString * const NSURLAuthenticationMethodNTLM; 58 extern NSString * const NSURLAuthenticationMethodNegotiate; 59 #endif 60 61 #if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) 62 extern NSString * const NSURLAuthenticationMethodClientCertificate; 63 extern NSString * const NSURLAuthenticationMethodServerTrust; 64 #endif 65 66 /** 67 * Class to encapsulate a protection space ... where authentication is 68 * required. 69 */ 70 @interface NSURLProtectionSpace : NSObject <NSCopying> 71 { 72 #if GS_EXPOSE(NSURLProtectionSpace) 73 void *_NSURLProtectionSpaceInternal; 74 #endif 75 } 76 77 /** 78 * Returns the authentication method used for this protection space. 79 */ 80 - (NSString *) authenticationMethod; 81 82 /** 83 * Returns the host (or proxy host) set in the receiver. 84 */ 85 - (NSString *) host; 86 87 /** 88 * Initialises the receiver with host, port, and protocol identifying the 89 * protection space. For some protocols the realm identifies a space 90 * within the host, for others it may be nil. 91 */ 92 - (id) initWithHost: (NSString *)host 93 port: (NSInteger)port 94 protocol: (NSString *)protocol 95 realm: (NSString *)realm 96 authenticationMethod: (NSString *)authenticationMethod; 97 98 /** 99 * This is like -initWithHost:port:protocol:realm:authenticationMethod: 100 * except that it uses a proxy host and proxy type rather than an actual 101 * host and a protocol. 102 */ 103 - (id) initWithProxyHost: (NSString *)host 104 port: (NSInteger)port 105 type: (NSString *)type 106 realm: (NSString *)realm 107 authenticationMethod: (NSString *)authenticationMethod; 108 109 /** 110 * Returns a flag to indicate whether this protection space is on a proxy 111 * server or not. 112 */ 113 - (BOOL) isProxy; 114 115 /** 116 * Returns the port set for this receiver or zero if none was set. 117 */ 118 - (NSInteger) port; 119 120 /** 121 * Returns the protocol of the receiver or nil if it is a proxy. 122 */ 123 - (NSString *) protocol; 124 125 /** 126 * Returns the proxy type set for the receiver or nil if it's not a proxy. 127 */ 128 - (NSString *) proxyType; 129 130 /** 131 * Returns the realm (or nil) which was set in the receiver upon initialisation. 132 */ 133 - (NSString *) realm; 134 135 /** 136 * Returns a flag to indicate whether the password for this protection space 137 * will be sent over a secure mechanism. 138 */ 139 - (BOOL) receivesCredentialSecurely; 140 141 #if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST) && GS_API_VERSION( 11300,GS_API_LATEST) 142 #if GS_HAS_DECLARED_PROPERTIES 143 @property (readonly, copy) NSArray *distinguishedNames; 144 #else 145 - (NSArray *) distinguishedNames; 146 #endif 147 #endif 148 149 @end 150 151 #if defined(__cplusplus) 152 } 153 #endif 154 155 #endif 156 157 #endif 158