Add log messages to troubleshoot OAuth/OpenID linking
Change-Id: Ic8e13eb570d66e144520c29cd65308ce1f1d15c1
diff --git a/gerrit-oauth/src/main/java/com/google/gerrit/httpd/auth/oauth/OAuthSession.java b/gerrit-oauth/src/main/java/com/google/gerrit/httpd/auth/oauth/OAuthSession.java
index 27a1f57..6e3ea7a 100644
--- a/gerrit-oauth/src/main/java/com/google/gerrit/httpd/auth/oauth/OAuthSession.java
+++ b/gerrit-oauth/src/main/java/com/google/gerrit/httpd/auth/oauth/OAuthSession.java
@@ -124,6 +124,7 @@
if (claimedId != null && actualId != null) {
if (claimedId.equals(actualId)) {
// Both link to the same account, that's what we expected.
+ log.debug("OAuth2: claimed identity equals current id");
} else {
// This is (for now) a fatal error. There are two records
// for what might be the same user.
@@ -138,6 +139,8 @@
} else if (claimedId != null && actualId == null) {
// Claimed account already exists: link to it.
//
+ log.info("OAuth2: linking claimed identity to {}",
+ claimedId.toString());
try {
accountManager.link(claimedId, areq);
} catch (OrmException e) {
@@ -148,6 +151,8 @@
return;
}
}
+ } else {
+ log.debug("OAuth2: claimed identity is empty");
}
areq.setUserName(user.getUserName());
areq.setEmailAddress(user.getEmailAddress());
diff --git a/gerrit-openid/src/main/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java b/gerrit-openid/src/main/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
index 1681bc2..44b58c3 100644
--- a/gerrit-openid/src/main/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
+++ b/gerrit-openid/src/main/java/com/google/gerrit/httpd/auth/openid/OpenIdServiceImpl.java
@@ -157,6 +157,7 @@
final AuthRequest aReq;
try {
aReq = manager.authenticate(state.discovered, state.retTo.toString());
+ log.debug("OpenID: openid-realm={}", state.contextUrl);
aReq.setRealm(state.contextUrl);
if (requestRegistration(aReq)) {