*/
private boolean isNTLMallowed = false;
protected boolean doAuthentication(final Credentials credentials)
throws AuthenticationException {
final SpnegoCredentials spnegoCredentials = (SpnegoCredentials) credentials;
Principal principal;
byte[] nextToken;
try {
// proceed authentication using jcifs
synchronized (this) {
this.authentication.reset();
this.authentication.process(spnegoCredentials.getInitToken());
principal = this.authentication.getPrincipal();
nextToken = this.authentication.getNextToken();
}
} catch (jcifs.spnego.AuthenticationException e) {
throw new BadCredentialsAuthenticationException(e);
}
// evaluate jcifs response
if (nextToken != null) {
logger.debug("Setting nextToken in credentials");
spnegoCredentials.setNextToken(nextToken);
} else {
logger.debug("nextToken is null");
}
if (principal != null) {
if (spnegoCredentials.isNtlm()) {
if (logger.isDebugEnabled()) {
logger.debug("NTLM Credentials is valid for user ["
+ principal.getName() + "]");
}
spnegoCredentials.setPrincipal(getSimplePrincipal(principal
.getName(), true));
return this.isNTLMallowed;
}
// else => kerberos
if (logger.isDebugEnabled()) {
logger.debug("Kerberos Credentials is valid for user ["
+ principal.getName() + "]");
}
spnegoCredentials.setPrincipal(getSimplePrincipal(principal
.getName(), false));
return true;
}