Basic authentication support
This commit is contained in:
@@ -18,6 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, assign) UInt16 port;
|
||||
@property (nonatomic, readonly) NSOperationQueue *operationQueue;
|
||||
|
||||
@property (nonatomic, assign) BOOL usesAccessControl;
|
||||
@property (nonatomic, strong) NSString *authUsername;
|
||||
@property (nonatomic, strong) NSString *authPassword;
|
||||
|
||||
@property (nonatomic, assign) BOOL usesSSL;
|
||||
@property (nonatomic, strong) NSString *sslCertPath;
|
||||
|
||||
|
||||
@@ -29,6 +29,28 @@
|
||||
return [[MBIMBridge sharedInstance] sslCertificateAndIdentity];
|
||||
}
|
||||
|
||||
- (BOOL)isPasswordProtected:(NSString *)path
|
||||
{
|
||||
return [[MBIMBridge sharedInstance] usesAccessControl];
|
||||
}
|
||||
|
||||
- (NSString *)passwordForUser:(NSString *)username
|
||||
{
|
||||
MBIMBridge *bridge = [MBIMBridge sharedInstance];
|
||||
if ([username isEqualToString:bridge.authUsername]) {
|
||||
return bridge.authPassword;
|
||||
}
|
||||
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (BOOL)useDigestAccessAuthentication
|
||||
{
|
||||
// TODO: should use digest all the time, but it's a bit more complicated. Allow this to be NO if
|
||||
// SSL is on, because then at least basic auth is encrypted
|
||||
return ![[MBIMBridge sharedInstance] usesSSL];
|
||||
}
|
||||
|
||||
- (BOOL)supportsMethod:(NSString *)method atPath:(NSString *)path
|
||||
{
|
||||
if ([method isEqualToString:@"GET"] || [method isEqualToString:@"POST"]) {
|
||||
|
||||
Reference in New Issue
Block a user