@return true if the principal was authenticated, false otherwise.
*/
public boolean isValid(Principal principal, Object credential, Subject activeSubject)
{
// Check the cache first
DomainInfo cacheInfo = getCacheInfo(principal, true);
if (trace)
log.trace("Begin isValid, principal:" + principal + ", cache info: " + cacheInfo);
boolean isValid = false;
if (principal != null && principal.getName() != null)
{
synchronized (principal.getName().intern())
{
if (cacheInfo != null)
{
isValid = validateCache(cacheInfo, credential, activeSubject);
cacheInfo.release();
}
if (isValid == false)
isValid = authenticate(principal, credential, activeSubject);
}
}
else
{
if (cacheInfo != null)
cacheInfo.release();
isValid = authenticate(principal, credential, activeSubject);
}
if (trace)
log.trace("End isValid, " + isValid);
return isValid;