}
public void activate(GSSCredential cred)
throws CredentialException {
if (cred == null) {
throw new CredentialException("No credential was provided for this context : " + dn);
}
try {
if (cred.getRemainingLifetime() == 0) {
throw new CredentialException("Credential is expired for this context : " + dn);
}
String credDn = cred.getName().toString();
if (!credDn.equals(dn)) {
throw new CredentialException("Credential dn [" + credDn + "] is invalid for this context : " + dn);
}
setDateLastActivated(new Date());
} catch (GSSException e) {
log.error("Unknown error for credential context : " + dn, e);
throw new CredentialException("Unknown error for credential context : " + dn, e);
}
CredentialManagerServiceImpl.setCredential(dn, cred);
this.credential = cred;
}