![]() |
IOS Streaming Browser 1.0
An IOS streaming browser to stream the display to others or to a projector
|
00001 #import <Foundation/Foundation.h> 00002 00003 #if TARGET_OS_IPHONE 00004 // Note: You may need to add the CFNetwork Framework to your project 00005 #import <CFNetwork/CFNetwork.h> 00006 #endif 00007 00008 @class HTTPMessage; 00009 00010 00011 @interface HTTPAuthenticationRequest : NSObject 00012 { 00013 /** 00014 Whether basic authentication basic access authentication is a method designed to allow a web browser, or other client program, to provide credentials – in the form of a user name and password – when making a request 00015 **/ 00016 BOOL isBasic; 00017 00018 /** 00019 Digest access authentication is one of the agreed methods a web server can use to negotiate credentials with a web user's browser. It uses encryption to send the password over the network which is safer than the Basic access authentication that sends plaintext. 00020 **/ 00021 BOOL isDigest; 00022 00023 /** 00024 base64 encoding of basic authentication credentials 00025 **/ 00026 NSString *base64Credentials; // basic or digest 00027 00028 /** 00029 The user's name in the specified realm. 00030 **/ 00031 NSString *username; 00032 00033 /** 00034 A string to be displayed to users so they know which username and password to use. This string should contain at least the name of the host performing the authentication and might additionally indicate the collection of users who might have access. An example might be "registered_users@gotham.news.com". 00035 **/ 00036 NSString *realm; 00037 00038 00039 /** 00040 A server-specified data string which should be uniquely generated each time a 401 response is made. It is recommended that this string be base64 or hexadecimal data. Specifically, since the string is passed in the header lines as a quoted string, the double-quote character is not allowed. 00041 **/ 00042 NSString *nonce; 00043 00044 /** 00045 The URI from Request-URI of the Request-Line; duplicated here because proxies are allowed to change the Request-Line in transit. 00046 **/ 00047 NSString *uri; 00048 00049 /** 00050 This directive is optional, but is made so only for backward compatibility with RFC 2069 [6]; it SHOULD be used by all implementations compliant with this version of the Digest scheme. If present, it is a quoted string of one or more tokens indicating the "quality of protection" values supported by the server. The value "auth" indicates authentication; the value "auth-int"indicates authentication with integrity protection; 00051 **/ 00052 NSString *qop; 00053 00054 /** 00055 This MUST be specified if a qop directive is sent (see above), and MUST NOT be specified if the server did not send a qop directive in the WWW-Authenticate header field. The nc-value is the hexadecimal count of the number of requests (including the current request) that the client has sent with the nonce value in this request. For example, in the first request sent in response to a given nonce value, the client sends "nc=00000001". The purpose of this directive is to allow the server to detect request replays by maintaining its own copy of this count - if the same nc-value is seen twice, then the request is a replay. 00056 **/ 00057 NSString *nc; 00058 00059 /** 00060 This MUST be specified if a qop directive is sent (see above), and MUST NOT be specified if the server did not send a qop directive in the WWW-Authenticate header field. The cnonce-value is an opaque quoted string value provided by the client and used by both client and server to avoid chosen plaintext attacks, to provide mutual authentication, and to provide some message integrity protection. 00061 **/ 00062 NSString *cnonce; 00063 00064 /** 00065 A string of 32 hex digits computed as defined below, which proves that the user knows a password 00066 **/ 00067 NSString *response; 00068 } 00069 00070 /** 00071 Initializes the HTTPAuthenticationRequest with an HTTPMessage 00072 param HTTPMessage 00073 returns id 00074 **/ 00075 - (id)initWithRequest:(HTTPMessage *)request; 00076 00077 /** 00078 Getter method for accessing whether basic authentication 00079 returns BOOL 00080 **/ 00081 - (BOOL)isBasic; 00082 00083 /** 00084 Getter method for accessing whether digest authentication 00085 returns BOOL 00086 **/ 00087 - (BOOL)isDigest; 00088 00089 /////////////////////// 00090 // Basic Authentication 00091 /////////////////////// 00092 00093 /** 00094 returns NSString 00095 **/ 00096 - (NSString *)base64Credentials; 00097 00098 /////////////////////////////// 00099 // Digest 00100 ////////////////////////////// 00101 00102 /** 00103 The user's name in the specified realm, encoded according to the value of the "charset" directive. This directive is required and MUST be present exactly once; otherwise, authentication fails. 00104 **/ 00105 - (NSString *)username; 00106 00107 /** 00108 The realm containing the user's account. This directive is required if the server provided any realms in the "digest-challenge", in which case it may appear exactly once and its value SHOULD be one of those realms. If the directive is missing, "realm-value" will set to the empty string when computing A1 (see below for details). 00109 00110 **/ 00111 - (NSString *)realm; 00112 00113 /** 00114 The server-specified data string received in the preceding digest-challenge. This directive is required and MUST be present exactly once; otherwise, authentication fails. 00115 **/ 00116 - (NSString *)nonce; 00117 00118 /** 00119 Indicates the principal name of the service with which the client wishes to connect, formed from the serv-type, host, and serv-name. For example, the FTP service on "ftp.example.com" would have a "digest-uri" value of "ftp/ftp.example.com"; the SMTP server from the example above would have a "digest-uri" value of "smtp/mail3.example.com/example.com". 00120 00121 Servers SHOULD check that the supplied value is correct. This will detect accidental connection to the incorrect server. It is also so that clients will be trained to provide values that will work with implementations that use a shared back-end authentication service that can provide server authentication. 00122 00123 The serv-type component should match the service being offered. The host component should match one of the host names of the host on which the service is running, or it's IP address. Servers SHOULD NOT normally support the IP address form, because server authentication by IP address is not very useful; they should only do so if the DNS is unavailable or unreliable. The serv-name component should match one of the service's configured service names. 00124 00125 This directive may appear at most once; if multiple instances are present, the client should abort the authentication exchange. 00126 00127 Note: In the HTTP use of Digest authentication, the digest-uri is the URI (usually a URL) of the resource requested -- hence the name of the directive. 00128 **/ 00129 - (NSString *)uri; 00130 00131 00132 /** 00133 Indicates what "quality of protection" the client accepted. If present, it may appear exactly once and its value MUST be one of the alternatives in qop-options. If not present, it defaults to "auth". These values affect the computation of the response. Note that this is a single token, not a quoted list of alternatives. 00134 **/ 00135 - (NSString *)qop; 00136 00137 /** 00138 The nc-value is the hexadecimal count of the number of requests (including the current request) that the client has sent with the nonce value in this request. For example, in the first request sent in response to a given nonce value, the client sends "nc=00000001". The purpose of this directive is to allow the server to detect request replays by maintaining its own copy of this count - if the same nc-value is seen twice, then the request is a replay. See the description below of the construction of the response value. This directive may appear at most once; if multiple instances are present, the client should abort the authentication exchange. 00139 **/ 00140 - (NSString *)nc; 00141 00142 /** 00143 A client-specified data string which MUST be different each time a digest-response is sent as part of initial authentication. The cnonce-value is an opaque quoted string value provided by the client and used by both client and server to avoid chosen plaintext attacks, and to provide mutual authentication. The security of the implementation depends on a good choice. It is RECOMMENDED that it contain at least 64 bits of entropy. This directive is required and MUST be present exactly once; otherwise, authentication fails. 00144 **/ 00145 - (NSString *)cnonce; 00146 00147 /** 00148 A string of 32 hex digits computed as defined below, which proves that the user knows a password. This directive is required and MUST be present exactly once; otherwise, authentication fails. 00149 **/ 00150 - (NSString *)response; 00151 00152 @end