Fix assembly of external id
Two tests for the master-branch of the cfoauth-plugin failed:
- testParseAccessTokenResponse
- testGetAsAccessToken
Both tests showed the same ComparisonFailure:
expected:<external[:]marissa> but was:<external[]marissa>
Since Commit 744d2b89 in Gerrit the scheme for external auth is defined
without the trailing ':'. The colon however was expected by the cfoauth
plugin, causing false assembly of the external id.
This change adds the addition of a colon, when defining the external ID
in the plugin code.
Change-Id: If3d0cc52c0e64fb2b9cf3ce0a4b0774e9533da56
diff --git a/src/main/java/com/googlesource/gerrit/plugins/cfoauth/CFOAuthService.java b/src/main/java/com/googlesource/gerrit/plugins/cfoauth/CFOAuthService.java
index 75ffe0d..b5b294e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/cfoauth/CFOAuthService.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/cfoauth/CFOAuthService.java
@@ -143,7 +143,7 @@
}
private static OAuthUserInfo getAsOAuthUserInfo(String username) {
- return new OAuthUserInfo(SCHEME_EXTERNAL + username,
+ return new OAuthUserInfo(SCHEME_EXTERNAL + ":" + username,
username, null, null, null);
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/cfoauth/UserInfo.java b/src/main/java/com/googlesource/gerrit/plugins/cfoauth/UserInfo.java
index 62ce5a0..d539301 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/cfoauth/UserInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/cfoauth/UserInfo.java
@@ -42,7 +42,7 @@
throw new IllegalArgumentException("emailAddress must not be null");
}
this.username = username;
- this.externalId = SCHEME_EXTERNAL + username;
+ this.externalId = SCHEME_EXTERNAL + ":" + username;
this.emailAddress = emailAddress;
this.displayName = username;
}