Hi,

I have peer-to-peer syncing working between my Mac and iPhone app.

I've currently setup my app so the user can optionally setup a password 
that is used to provide authentication info to the CBLListener and 
CBLReplicator.

So there are two things I'm doing, one setting the username and password 
dictionary on the listener:

[self.syncListener setPasswords:@{self.documentID: self.
syncPasswordFromKeychain}];

according to the docs, this also sets the requiresAuth flag too. And it is 
set when I check it.

and then generating a URL that has the username and password in it:

- (NSURL *)peerURLWithSSL:(BOOL)ssl {

NSURLComponents *components = [[NSURLComponents alloc] init];

components.scheme = (ssl ? @"https" : @"http");

components.host = self.service.hostName;

components.port = @(self.service.port);

components.path = [@"/" stringByAppendingString:self.databaseDocument.
documentID];

if (self.databaseDocument.syncPasswordFromKeychain) {

components.user = self.databaseDocument.documentID;

components.password = self.databaseDocument.syncPasswordFromKeychain;

}


return components.URL;

}


However I'm not entirely sure how to validate the passwords so I can 
display an error letting the user know they require a valid password. I 
implemented the CBLListener delegate passwordForUser: but it never seems to 
get called. I've set my class as the delegate for the listener.

According to the documentation:

/** Authenticates a request that uses Basic or Digest authentication.

    If this method is not implemented, the `passwords` dictionary 
registered with the CBLListener

    is consulted instead. **/

I thought if I could implement that method then I could decide if I should 
show an error or not. Otherwise, I do have the passwords dictionary also 
set as above.

So anyway, if there's some guidance on using basic authentication that 
would be great. I have read the Wiki page on certificate authentication, 
but I've been trying to make it work with basic authentication over SSL.

I'm using the latest build from master.

Thanks,

Brendan

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/ff18bbb9-18ac-4f4d-9c8c-fbb23f41efab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to