@Override
  public boolean authorizeUser(String userName, int verificationCode)
      throws GoogleAuthenticatorException {

    ICredentialRepository repository = getValidCredentialRepository();

    return authorize(repository.getSecretKey(userName), verificationCode);
  }
  @Override
  @SuppressWarnings("UnusedDeclaration")
  public boolean authorizeUser(String userName, int verificationCode, int window)
      throws GoogleAuthenticatorException {
    ICredentialRepository repository = getValidCredentialRepository();

    return authorize(repository.getSecretKey(userName), verificationCode, window);
  }
  @Override
  public GoogleAuthenticatorKey createCredentials(String userName) {
    // Further validation will be performed by the configured provider.
    if (userName == null) {
      throw new IllegalArgumentException("User name cannot be null.");
    }

    GoogleAuthenticatorKey key = createCredentials();

    ICredentialRepository repository = getValidCredentialRepository();
    repository.saveUserCredentials(
        userName, key.getKey(), key.getVerificationCode(), key.getScratchCodes());

    return key;
  }