{
String nonce = _consumerNonceGenerator.next();
returnTo += (returnTo.indexOf('?') != -1) ? '&' : '?';
Association privateAssoc = _privateAssociations.load(opUrl);
if( privateAssoc == null )
{
try
{
if (DEBUG) _log.debug( "Creating private association for opUrl " + opUrl);
privateAssoc = Association.generate(
getPrefAssocSessEnc().getAssociationType(), "", _failedAssocExpire);
_privateAssociations.save( opUrl, privateAssoc );
}
catch ( AssociationException e )
{
_log.error("Cannot initialize private association.", e);
return null;
}
}
try
{
returnTo += "openid.rpnonce=" + URLEncoder.encode(nonce, "UTF-8");
returnTo += "&openid.rpsig=" +
URLEncoder.encode(privateAssoc.sign(returnTo),
"UTF-8");
_log.info("Inserted consumer nonce: " + nonce);
if (DEBUG) _log.debug("return_to:" + returnTo);