I am creating for our web application a tokensystem. What do you guys think, if is this isWebTokenAvailable()
Method safe?
/**
* Checked if webToken is available {@link de.security.WebToken}.
*
* @param webToken to check if webToken is available.
* @return true if webToken is available and if there is no available token then returns false.
*/
public boolean isWebTokenAvailable(@NonNull String webToken) {
return !em.createNamedQuery("validateToken").setParameter("token", webToken)
.getResultList().isEmpty();
}
As far as i have understood,if you have authentication concerns, you just need to verify the below steps: