Change check of token.getUsername() in doGetAuthenticationInfo by using StringUtils::isBlank instead of checking only null.

This commit is contained in:
Anthony Corbacho 2016-07-13 12:39:33 +09:00
parent 38683e17a3
commit c207b5e402

View file

@ -77,8 +77,8 @@ public class ZeppelinHubRealm extends AuthorizingRealm {
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authToken)
throws AuthenticationException {
UsernamePasswordToken token = (UsernamePasswordToken) authToken;
if (token.getUsername() == null) {
throw new AccountException("Null usernames are not allowed by this realm.");
if (StringUtils.isBlank(token.getUsername())) {
throw new AccountException("Empty usernames are not allowed by this realm.");
}
String loginPayload = createLoginPayload(token.getUsername(), token.getPassword());
User user = authenticateUser(loginPayload);