}
// Otherwise, try to extract the session key from the token if a KerberosTokenDecoder implementation is
// available
if (null == credential.getSecretKey()) {
KerberosTokenDecoder kerberosTokenDecoder = this.kerberosTokenDecoder;
if (kerberosTokenDecoder == null) {
kerberosTokenDecoder = new KerberosTokenDecoderImpl();
}
LOG.debug("KerberosTokenDecoder is set.Trying to obtain the session key from it.");
kerberosTokenDecoder.clear();
kerberosTokenDecoder.setToken(token);
kerberosTokenDecoder.setSubject(subject);
try {
byte[] key = kerberosTokenDecoder.getSessionKey();
if (null != key) {
LOG.debug("Session key obtained from the KerberosTokenDecoder.");
credential.setSecretKey(key);
} else {
LOG.debug("Session key could not be obtained from the KerberosTokenDecoder.");