/** * Verifies that the given identifier and password are valid and match. * @param identifier Token identifier. * @param password Password in the token. * @throws InvalidToken */ public synchronized void verifyToken(TokenIdent identifier, byte[] password) throws InvalidToken { byte[] storedPassword = retrievePassword(identifier); if (!MessageDigest.isEqual(password, storedPassword)) { throw new InvalidToken("token " + formatTokenId(identifier) + " is invalid, password doesn't match"); } }
@Override public byte[] retriableRetrievePassword(DelegationTokenIdentifier identifier) throws InvalidToken, StandbyException, RetriableException, IOException { namesystem.checkOperation(OperationCategory.READ); try { return super.retrievePassword(identifier); } catch (InvalidToken it) { if (namesystem.inTransitionToActive()) { // if the namesystem is currently in the middle of transition to // active state, let client retry since the corresponding editlog may // have not been applied yet throw new RetriableException(it); } else { throw it; } } }
throw wrappedStandby; return super.retrievePassword(identifier);
/** * Verifies that the given identifier and password are valid and match. * @param identifier Token identifier. * @param password Password in the token. * @throws InvalidToken */ public synchronized void verifyToken(TokenIdent identifier, byte[] password) throws InvalidToken { byte[] storedPassword = retrievePassword(identifier); if (!Arrays.equals(password, storedPassword)) { throw new InvalidToken("token (" + identifier + ") is invalid, password doesn't match"); } }
/** * Verifies that the given identifier and password are valid and match. * @param identifier Token identifier. * @param password Password in the token. * @throws InvalidToken */ public synchronized void verifyToken(TokenIdent identifier, byte[] password) throws InvalidToken { byte[] storedPassword = retrievePassword(identifier); if (!MessageDigest.isEqual(password, storedPassword)) { throw new InvalidToken("token (" + identifier + ") is invalid, password doesn't match"); } }
/** * Verifies that the given identifier and password are valid and match. * @param identifier Token identifier. * @param password Password in the token. * @throws InvalidToken */ public synchronized void verifyToken(TokenIdent identifier, byte[] password) throws InvalidToken { byte[] storedPassword = retrievePassword(identifier); if (!MessageDigest.isEqual(password, storedPassword)) { throw new InvalidToken("token (" + identifier + ") is invalid, password doesn't match"); } }
/** * Verifies that the given identifier and password are valid and match. * @param identifier Token identifier. * @param password Password in the token. * @throws InvalidToken */ public synchronized void verifyToken(TokenIdent identifier, byte[] password) throws InvalidToken { byte[] storedPassword = retrievePassword(identifier); if (!MessageDigest.isEqual(password, storedPassword)) { throw new InvalidToken("token " + formatTokenId(identifier) + " is invalid, password doesn't match"); } }
@Override public byte[] retriableRetrievePassword(DelegationTokenIdentifier identifier) throws InvalidToken, StandbyException, RetriableException, IOException { namesystem.checkOperation(OperationCategory.READ); try { return super.retrievePassword(identifier); } catch (InvalidToken it) { if (namesystem.inTransitionToActive()) { // if the namesystem is currently in the middle of transition to // active state, let client retry since the corresponding editlog may // have not been applied yet throw new RetriableException(it); } else { throw it; } } }
@Override public byte[] retriableRetrievePassword(DelegationTokenIdentifier identifier) throws InvalidToken, StandbyException, RetriableException, IOException { namesystem.checkOperation(OperationCategory.READ); try { return super.retrievePassword(identifier); } catch (InvalidToken it) { if (namesystem.inTransitionToActive()) { // if the namesystem is currently in the middle of transition to // active state, let client retry since the corresponding editlog may // have not been applied yet throw new RetriableException(it); } else { throw it; } } }
throw wrappedStandby; return super.retrievePassword(identifier);
throw wrappedStandby; return super.retrievePassword(identifier);