Skip to content
This repository
Browse code

Change BrowserID login path to /db/_browserid, for Sync Gateway.

  • Loading branch information...
commit b620e129aa043c3857d98eec0ecfd36550f46a0b 1 parent 78a2ad7
Jens Alfke authored March 18, 2013
2  Source/TDAuthorizer.h
@@ -22,7 +22,7 @@
22 22
 
23 23
 @optional
24 24
 
25  
-@property (readonly) NSString* loginPath;
  25
+- (NSString*) loginPathForSite: (NSURL*)site;
26 26
 - (NSDictionary*) loginParametersForSite: (NSURL*)site;
27 27
 
28 28
 @end
2  Source/TDAuthorizer.m
@@ -77,7 +77,7 @@ - (NSString*) description {
77 77
 // but there's not really much point in doing so, as such logins expire, which would cause trouble
78 78
 // with long-lived replications.
79 79
 
80  
-- (NSString*) loginPath {
  80
+- (NSString*) loginPathForSite: (NSURL*)site {
81 81
     return @"/_session";
82 82
 }
83 83
 
4  Source/TDBrowserIDAuthorizer.m
@@ -125,8 +125,8 @@ - (NSString*) authorizeHTTPMessage: (CFHTTPMessageRef)message
125 125
 }
126 126
 
127 127
 
128  
-- (NSString*) loginPath {
129  
-    return @"/_browserid";
  128
+- (NSString*) loginPathForSite:(NSURL *)site {
  129
+    return [site.path stringByAppendingPathComponent: @"_browserid"];
130 130
 }
131 131
 
132 132
 
5  Source/TDReplicator.m
@@ -475,10 +475,11 @@ - (void) login {
475 475
         return;
476 476
     }
477 477
 
478  
-    LogTo(Sync, @"%@: Logging in with %@ at %@ ...", self, _authorizer.class, _authorizer.loginPath);
  478
+    NSString* loginPath = [_authorizer loginPathForSite: _remote];
  479
+    LogTo(Sync, @"%@: Logging in with %@ at %@ ...", self, _authorizer.class, loginPath);
479 480
     [self asyncTaskStarted];
480 481
     [self sendAsyncRequest: @"POST"
481  
-                      path: _authorizer.loginPath
  482
+                      path: loginPath
482 483
                       body: loginParameters
483 484
               onCompletion: ^(id result, NSError *error) {
484 485
                   if (error) {

0 notes on commit b620e12

Please sign in to comment.
Something went wrong with that request. Please try again.