final ClientSecurityDescriptor csd =
WSUtils.getClientSecDesc(this.d.delegationSecMechanism,
this.d.delegationProtection,
this.d.delegationAuthorization);
final EndpointReferenceType delegEpr = AddressingUtils.
createEndpointReference(this.d.delegationFactoryUrl, null);
final X509Certificate[] certsToDelegateOn =
DelegationUtil.getCertificateChainRP(delegEpr, csd);
final X509Certificate certToSign = certsToDelegateOn[0];
if (this.pr.enabled()) {
final String msg = "Delegating for staging credential(s).";
if (this.pr.useThis()) {
this.pr.infoln(PrCodes.DELEGATE__ALLMESSAGES,
msg);
} else if (this.pr.useLogging()) {
logger.info(msg);
}
}
if (this.pr.enabled()) {
final StringBuffer buf = new StringBuffer(512);
buf.append("\nAbout to call delegation.\n - Client credential: ")
.append(credential.getIdentity())
.append("\n - Factory URL: ")
.append(this.d.delegationFactoryUrl)
.append("\n - Security mechanism: ")
.append(this.d.delegationSecMechanism)
.append("\n - Protection mechanism: ")
.append(this.d.delegationProtection)
.append("\n - Authorization: ")
.append(this.d.delegationAuthorization.getClass().getName())
.append("\n - Cert to sign: ")
.append(certToSign.getSubjectDN().getName());
final String dbg = buf.toString();
if (this.pr.useThis()) {
this.pr.dbg(dbg);
} else if (this.pr.useLogging()) {
logger.debug(dbg);
}
}
final Delegate delegate = new Delegate(credential,
csd,
this.d.delegationFactoryUrl,
certToSign,
this.d.delegationLifetime,
true);
delegate.validateAll();
if (this.d.dryrun) {
if (this.pr.enabled()) {
final String msg = "Dryrun, not calling delegation service.";
if (this.pr.useThis()) {
// part of PRCODE_CREATE__DRYRUN as a whole
this.pr.infoln(PrCodes.CREATE__DRYRUN, msg);
} else if (this.pr.useLogging()) {
logger.info(msg);
}
}
return; // *** EARLY RETURN ***
}
final EndpointReferenceType epr = delegate.delegate();
//this.delegationWasPerformed = true;
final OptionalParameters_Type opt = this.d.optionalParameters;
if (opt == null) {