@Test(expected = AuthenticationException.class) public void testBadPasswordLogIn() { LoginToken token = defaultAuthentication.logIn(DefaultAuthentication.BASIC + " " + new String(Base64.encodeBase64(WASABI_ADMIN_ADMIN_WASABI.getBytes(TestUtil.CHARSET)))); assertThat(token, is(LoginToken.withAccessToken( new String(Base64.encodeBase64(WASABI_ADMIN_ADMIN_WASABI.getBytes(TestUtil.CHARSET)))) .withTokenType(DefaultAuthentication.BASIC).build() ) ); }
@Override public LoginToken logIn(final String authHeader) { LOGGER.debug("Authentication header received as: {}", authHeader); UserCredential credential = parseUsernamePassword(fromNullable(authHeader)); if (isBasicAuthenicationValid(credential)) { return withAccessToken(credential.toBase64Encode()).withTokenType(BASIC).build(); } else { throw new AuthenticationException("Authentication login failed. Invalid Login Credential"); } }
DefaultAuthentication implements Authentication { @Override public LoginToken logIn(final String authHeader) { LOGGER.debug("Authentication header received as: {}", authHeader); UserCredential credential = parseUsernamePassword(fromNullable(authHeader)); if (isBasicAuthenicationValid(credential)) { return withAccessToken(credential.toBase64Encode()).withTokenType(BASIC).build(); } else { throw new AuthenticationException("Authentication login failed. Invalid Login Credential"); } } }
DefaultAuthentication implements Authentication { @Override public LoginToken logIn(final String authHeader) { LOGGER.debug("Authentication header received as: {}", authHeader); UserCredential credential = parseUsernamePassword(fromNullable(authHeader)); if (isBasicAuthenicationValid(credential)) { return withAccessToken(credential.toBase64Encode()).withTokenType(BASIC).build(); } else { throw new AuthenticationException("Authentication login failed. Invalid Login Credential"); } } @Inject  DefaultAuthentication(final UserDirectory userDirectory); }
DefaultAuthentication implements Authentication { @Override public LoginToken logIn(final String authHeader) { LOGGER.debug("Authentication header received as: {}", authHeader); UserCredential credential = parseUsernamePassword(fromNullable(authHeader)); if (isBasicAuthenicationValid(credential)) { return withAccessToken(credential.toBase64Encode()).withTokenType(BASIC).build(); } else { throw new AuthenticationException("Authentication login failed. Invalid Login Credential"); } } @Inject  DefaultAuthentication(final UserDirectory userDirectory); @Override LoginToken logIn(final String authHeader); @Override LoginToken verifyToken(final String tokenHeader); @Override boolean logOut(final String tokenHeader); @Override UserInfo getUserExists(final String userEmail); }
DefaultAuthentication implements Authentication { @Override public LoginToken logIn(final String authHeader) { LOGGER.debug("Authentication header received as: {}", authHeader); UserCredential credential = parseUsernamePassword(fromNullable(authHeader)); if (isBasicAuthenicationValid(credential)) { return withAccessToken(credential.toBase64Encode()).withTokenType(BASIC).build(); } else { throw new AuthenticationException("Authentication login failed. Invalid Login Credential"); } } @Inject  DefaultAuthentication(final UserDirectory userDirectory); @Override LoginToken logIn(final String authHeader); @Override LoginToken verifyToken(final String tokenHeader); @Override boolean logOut(final String tokenHeader); @Override UserInfo getUserExists(final String userEmail); static final String BASIC; static final String EMPTY; }