secret = tempSecret;
}
public Authentication authenticate(Authentication arg0)
throws AuthenticationException {
UsernamePasswordAuthenticationToken auth = (UsernamePasswordAuthenticationToken)arg0;
String token = (auth.getCredentials() == null ? "" : auth.getCredentials().toString());
if (token.length() > 40)
token = token.substring(0, 40);
// the token is expected to be 40 characters, this may change depending on the hash function used
// the truncating is only needed to deal with weird garbage characters added by tomcat
LOGGER.info("input:" + token);
if (getAuth(auth.getName()).equals(token)) {
return createNewAuthentication(auth);
}
throw new BadCredentialsException("something went wrong");
}