Bug 1240919 - Part 3: Cull unused methods. r=rnewman
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClient.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClient.java
@@ -1,21 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.background.fxa;
-import java.util.Map;
-
import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate;
import org.mozilla.gecko.background.fxa.FxAccountClient10.StatusResponse;
import org.mozilla.gecko.background.fxa.FxAccountClient10.TwoKeys;
-import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse;
import org.mozilla.gecko.sync.ExtendedJSONObject;
public interface FxAccountClient {
- public void createAccountAndGetKeys(final byte[] emailUTF8, final PasswordStretcher passwordStretcher, final Map<String, String> queryParameters, final RequestDelegate<LoginResponse> delegate);
- public void loginAndGetKeys(final byte[] emailUTF8, final PasswordStretcher passwordStretcher, final Map<String, String> queryParameters, final RequestDelegate<LoginResponse> requestDelegate);
public void status(byte[] sessionToken, RequestDelegate<StatusResponse> requestDelegate);
public void keys(byte[] keyFetchToken, RequestDelegate<TwoKeys> requestDelegate);
public void sign(byte[] sessionToken, ExtendedJSONObject publicKey, long certificateDurationInMilliseconds, RequestDelegate<String> requestDelegate);
}
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClient20.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClient20.java
@@ -151,31 +151,16 @@ public class FxAccountClient20 extends F
delegate.handleError(e);
}
}
};
post(resource, body, delegate);
}
- @Override
- public void createAccountAndGetKeys(byte[] emailUTF8, PasswordStretcher passwordStretcher, final Map<String, String> queryParameters, RequestDelegate<LoginResponse> delegate) {
- try {
- byte[] quickStretchedPW = passwordStretcher.getQuickStretchedPW(emailUTF8);
- createAccount(emailUTF8, quickStretchedPW, true, false, queryParameters, delegate);
- } catch (Exception e) {
- invokeHandleError(delegate, e);
- }
- }
-
- @Override
- public void loginAndGetKeys(byte[] emailUTF8, PasswordStretcher passwordStretcher, final Map<String, String> queryParameters, RequestDelegate<LoginResponse> delegate) {
- login(emailUTF8, passwordStretcher, true, queryParameters, delegate);
- }
-
/**
* We want users to be able to enter their email address case-insensitively.
* We stretch the password locally using the email address as a salt, to make
* dictionary attacks more expensive. This means that a client with a
* case-differing email address is unable to produce the correct
* authorization, even though it knows the password. In this case, the server
* returns the email that the account was created with, so that the client can
* re-stretch the password locally with the correct email salt. This version
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/fxa/login/MockFxAccountClient.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/fxa/login/MockFxAccountClient.java
@@ -101,43 +101,16 @@ public class MockFxAccountClient impleme
if (email == null || user == null) {
handleFailure(requestDelegate, HttpStatus.SC_UNAUTHORIZED, FxAccountRemoteError.INVALID_AUTHENTICATION_TOKEN, "invalid sessionToken");
return;
}
requestDelegate.handleSuccess(new StatusResponse(email, user.verified));
}
@Override
- public void loginAndGetKeys(byte[] emailUTF8, final PasswordStretcher passwordStretcher, final Map<String, String> queryParameters, RequestDelegate<LoginResponse> requestDelegate) {
- User user;
- try {
- user = users.get(new String(emailUTF8, "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- user = null;
- }
- if (user == null) {
- handleFailure(requestDelegate, HttpStatus.SC_BAD_REQUEST, FxAccountRemoteError.ATTEMPT_TO_CREATE_AN_ACCOUNT_THAT_ALREADY_EXISTS, "invalid emailUTF8");
- return;
- }
- byte[] quickStretchedPW;
- try {
- quickStretchedPW = passwordStretcher.getQuickStretchedPW(emailUTF8);
- } catch (Exception e) {
- handleFailure(requestDelegate, HttpStatus.SC_INTERNAL_SERVER_ERROR, 999, "error stretching password");
- return;
- }
- if (user.quickStretchedPW == null || !Arrays.equals(user.quickStretchedPW, quickStretchedPW)) {
- handleFailure(requestDelegate, HttpStatus.SC_BAD_REQUEST, FxAccountRemoteError.INCORRECT_PASSWORD, "invalid quickStretchedPW");
- return;
- }
- LoginResponse loginResponse = addLogin(user, Utils.generateRandomBytes(8), Utils.generateRandomBytes(8));
- requestDelegate.handleSuccess(loginResponse);
- }
-
- @Override
public void keys(byte[] keyFetchToken, RequestDelegate<TwoKeys> requestDelegate) {
String email = keyFetchTokens.get(Utils.byte2Hex(keyFetchToken));
User user = users.get(email);
if (email == null || user == null) {
handleFailure(requestDelegate, HttpStatus.SC_UNAUTHORIZED, FxAccountRemoteError.INVALID_AUTHENTICATION_TOKEN, "invalid keyFetchToken");
return;
}
if (!user.verified) {
@@ -164,14 +137,9 @@ public class MockFxAccountClient impleme
final long dur = certificateDurationInMilliseconds;
final long exp = iat + dur;
String certificate = mockMyIdTokenFactory.createMockMyIDCertificate(RSACryptoImplementation.createPublicKey(publicKey), "test", iat, exp);
requestDelegate.handleSuccess(certificate);
} catch (Exception e) {
requestDelegate.handleError(e);
}
}
-
- @Override
- public void createAccountAndGetKeys(byte[] emailUTF8, PasswordStretcher passwordStretcher, final Map<String, String> queryParameters, RequestDelegate<LoginResponse> delegate) {
- delegate.handleError(new RuntimeException("Not yet implemented"));
- }
}