Permalink
Browse files

Rename "BrowserID" --> "Persona"

Note that this invalidates all saved persistent replications that used Persona/BrowserID auth,
because the property in the replication doc was renamed too.
It also changes the server endpoint that the replicator hits to log in from /db/browserid to /db/persona.

(This is equivalent to commit 111859c from CouchbaseLite, although it's not a direct cherry-pick. I had to make the same changes manually because too many things have been renamed for a merge to work.)
  • Loading branch information...
snej committed Mar 27, 2013
1 parent 437a896 commit ec50437dad477fc5f7fb39defbb378fa1b481cb6
@@ -1,5 +1,5 @@
//
-// TDBrowserIDAuthorizer.h
+// TDPersonaAuthorizer.h
// TouchDB
//
// Created by Jens Alfke on 1/9/13.
@@ -8,7 +8,8 @@
#import "TDAuthorizer.h"
-@interface TDBrowserIDAuthorizer: NSObject <TDAuthorizer>
+/** Authorizer for the Persona decentralized-identity system. See http://persona.org */
+@interface TDPersonaAuthorizer: NSObject <TDAuthorizer>
+ (NSURL*) originForSite: (NSURL*)url;
@@ -1,18 +1,18 @@
//
-// TDBrowserIDAuthorizer.m
+// TDPersonaAuthorizer.m
// TouchDB
//
// Created by Jens Alfke on 1/9/13.
//
//
-#import "TDBrowserIDAuthorizer.h"
+#import "TDPersonaAuthorizer.h"
#import "TDBase64.h"
static NSMutableDictionary* sAssertions;
-@implementation TDBrowserIDAuthorizer
+@implementation TDPersonaAuthorizer
static NSDictionary* decodeComponent(NSArray* components, NSUInteger index) {
@@ -126,7 +126,7 @@ - (NSString*) authorizeHTTPMessage: (CFHTTPMessageRef)message
- (NSString*) loginPathForSite:(NSURL *)site {
- return [site.path stringByAppendingPathComponent: @"_browserid"];
+ return [site.path stringByAppendingPathComponent: @"_persona"];
}
@@ -140,7 +140,7 @@ - (NSDictionary*) loginParametersForSite: (NSURL*)site {
-TestCase(TEBrowserIDAuthorizer) {
+TestCase(TEPersonaAuthorizer) {
NSString* email, *origin;
NSDate* exp;
CAssert(!parseAssertion(@"", &email, &origin, &exp));
@@ -154,13 +154,13 @@ - (NSDictionary*) loginParametersForSite: (NSURL*)site {
// Register and retrieve the sample assertion:
NSURL* originURL = [NSURL URLWithString: origin];
- CAssertEqual([TDBrowserIDAuthorizer registerAssertion: sampleAssertion], email);
- NSString* gotAssertion = [TDBrowserIDAuthorizer takeAssertionForEmailAddress: email
+ CAssertEqual([TDPersonaAuthorizer registerAssertion: sampleAssertion], email);
+ NSString* gotAssertion = [TDPersonaAuthorizer takeAssertionForEmailAddress: email
site: originURL];
CAssertEqual(gotAssertion, sampleAssertion);
// -assertionForSite: should return nil because the assertion has expired by now:
- TDBrowserIDAuthorizer* auth = [[TDBrowserIDAuthorizer alloc] initWithEmailAddress: email];
+ TDPersonaAuthorizer* auth = [[TDPersonaAuthorizer alloc] initWithEmailAddress: email];
CAssertEqual(auth.emailAddress, email);
CAssertEqual([auth assertionForSite: originURL], nil);
}
@@ -16,7 +16,7 @@
#import "TD_DatabaseManager.h"
#import "TD_Database.h"
#import "TDOAuth1Authorizer.h"
-#import "TDBrowserIDAuthorizer.h"
+#import "TDPersonaAuthorizer.h"
#import "TDPusher.h"
#import "TDReplicatorManager.h"
#import "TDInternal.h"
@@ -270,10 +270,10 @@ - (TDStatus) parseReplicatorProperties: (NSDictionary*)properties
tokenSecret: tokenSec
signatureMethod: sigMethod];
} else {
- NSDictionary* browserid = $castIf(NSDictionary, auth[@"browserid"]);
- if (browserid) {
- NSString* email = $castIf(NSString, browserid[@"email"]);
- *outAuthorizer = [[TDBrowserIDAuthorizer alloc] initWithEmailAddress: email];
+ NSDictionary* persona = $castIf(NSDictionary, auth[@"persona"]);
+ if (persona) {
+ NSString* email = $castIf(NSString, persona[@"email"]);
+ *outAuthorizer = [[TDPersonaAuthorizer alloc] initWithEmailAddress: email];
}
}
if (!*outAuthorizer)
View
@@ -10,6 +10,7 @@
.objc_class_name_TDReplicator
.objc_class_name_TDPusher
.objc_class_name_TDPuller
+.objc_class_name_TDPersonaAuthorizer
.objc_class_name_TDURLProtocol
.objc_class_name_TDRouter
@@ -167,9 +167,9 @@
2773ADC814BD1EB80027A292 /* TD_Database+LocalDocs.m in Sources */ = {isa = PBXBuildFile; fileRef = 2773ADC614BD1EB80027A292 /* TD_Database+LocalDocs.m */; };
2773ADC914BD1EB80027A292 /* TD_Database+LocalDocs.m in Sources */ = {isa = PBXBuildFile; fileRef = 2773ADC614BD1EB80027A292 /* TD_Database+LocalDocs.m */; };
2776A538169F4C41006FF199 /* TDBrowserIDAuthorizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2776A536169F4C41006FF199 /* TDBrowserIDAuthorizer.h */; };
- 2776A5D516A61FD6006FF199 /* TDBrowserIDAuthorizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2776A5D316A61FD6006FF199 /* TDBrowserIDAuthorizer.h */; };
- 2776A5D616A61FD6006FF199 /* TDBrowserIDAuthorizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2776A5D416A61FD6006FF199 /* TDBrowserIDAuthorizer.m */; };
- 2776A5D716A61FD6006FF199 /* TDBrowserIDAuthorizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2776A5D416A61FD6006FF199 /* TDBrowserIDAuthorizer.m */; };
+ 2776A5D516A61FD6006FF199 /* TDPersonaAuthorizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2776A5D316A61FD6006FF199 /* TDPersonaAuthorizer.h */; };
+ 2776A5D616A61FD6006FF199 /* TDPersonaAuthorizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2776A5D416A61FD6006FF199 /* TDPersonaAuthorizer.m */; };
+ 2776A5D716A61FD6006FF199 /* TDPersonaAuthorizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2776A5D416A61FD6006FF199 /* TDPersonaAuthorizer.m */; };
2781E3C915C31FDA00E970DC /* MYRegexUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 2781E3C715C31FDA00E970DC /* MYRegexUtils.h */; };
2781E3CA15C31FDA00E970DC /* MYRegexUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 2781E3C815C31FDA00E970DC /* MYRegexUtils.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
2781E3CB15C31FDA00E970DC /* MYRegexUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 2781E3C815C31FDA00E970DC /* MYRegexUtils.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
@@ -649,8 +649,8 @@
2773ADC514BD1EB80027A292 /* TD_Database+LocalDocs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TD_Database+LocalDocs.h"; sourceTree = "<group>"; };
2773ADC614BD1EB80027A292 /* TD_Database+LocalDocs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TD_Database+LocalDocs.m"; sourceTree = "<group>"; };
2776A536169F4C41006FF199 /* TDBrowserIDAuthorizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TDBrowserIDAuthorizer.h; sourceTree = "<group>"; };
- 2776A5D316A61FD6006FF199 /* TDBrowserIDAuthorizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TDBrowserIDAuthorizer.h; sourceTree = "<group>"; };
- 2776A5D416A61FD6006FF199 /* TDBrowserIDAuthorizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TDBrowserIDAuthorizer.m; sourceTree = "<group>"; };
+ 2776A5D316A61FD6006FF199 /* TDPersonaAuthorizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TDPersonaAuthorizer.h; sourceTree = "<group>"; };
+ 2776A5D416A61FD6006FF199 /* TDPersonaAuthorizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TDPersonaAuthorizer.m; sourceTree = "<group>"; };
2781E3C715C31FDA00E970DC /* MYRegexUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MYRegexUtils.h; sourceTree = "<group>"; };
2781E3C815C31FDA00E970DC /* MYRegexUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MYRegexUtils.m; sourceTree = "<group>"; };
27821BB5148E7D6F0099B373 /* TDReplicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TDReplicator.h; sourceTree = "<group>"; };
@@ -1182,8 +1182,8 @@
children = (
270F5703156AE0BF000FEB8F /* TDAuthorizer.h */,
270F5704156AE0BF000FEB8F /* TDAuthorizer.m */,
- 2776A5D316A61FD6006FF199 /* TDBrowserIDAuthorizer.h */,
- 2776A5D416A61FD6006FF199 /* TDBrowserIDAuthorizer.m */,
+ 2776A5D316A61FD6006FF199 /* TDPersonaAuthorizer.h */,
+ 2776A5D416A61FD6006FF199 /* TDPersonaAuthorizer.m */,
27F128AF156AC1C8008465C2 /* TDOAuth1Authorizer.h */,
27F128B0156AC1C9008465C2 /* TDOAuth1Authorizer.m */,
);
@@ -1540,7 +1540,7 @@
2781E3C915C31FDA00E970DC /* MYRegexUtils.h in Headers */,
27ED9AA1163B01D5000C844A /* TDSocketChangeTracker.h in Headers */,
2776A538169F4C41006FF199 /* TDBrowserIDAuthorizer.h in Headers */,
- 2776A5D516A61FD6006FF199 /* TDBrowserIDAuthorizer.h in Headers */,
+ 2776A5D516A61FD6006FF199 /* TDPersonaAuthorizer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2089,7 +2089,7 @@
27F128B8156AC8EC008465C2 /* OAConsumer.m in Sources */,
27F128B9156AC8F0008465C2 /* OAMutableURLRequest.m in Sources */,
270F5702156AD215000FEB8F /* OARequestParameter.m in Sources */,
- 2776A5D616A61FD6006FF199 /* TDBrowserIDAuthorizer.m in Sources */,
+ 2776A5D616A61FD6006FF199 /* TDPersonaAuthorizer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2208,7 +2208,7 @@
27F128A9156ABFE0008465C2 /* NSMutableURLRequest+Parameters.m in Sources */,
275F535215C04F7B00BAF578 /* MYStreamUtils.m in Sources */,
2781E3CB15C31FDA00E970DC /* MYRegexUtils.m in Sources */,
- 2776A5D716A61FD6006FF199 /* TDBrowserIDAuthorizer.m in Sources */,
+ 2776A5D716A61FD6006FF199 /* TDPersonaAuthorizer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit ec50437

Please sign in to comment.