if (DEBUG) _log.debug("Using ClaimedID: " + claimed +
" OP-specific ID: " + id);
if (authenticatedAndApproved) // positive response
{
Association assoc = null;
String handle = authReq.getHandle();
String invalidateHandle = null;
if (handle != null)
{
assoc = _sharedAssociations.load(handle);
if (assoc == null)
{
_log.info("Invalidating handle: " + handle);
invalidateHandle = handle;
}
else
_log.info("Loaded shared association; hadle: " + handle);
}
if (assoc == null)
{
assoc = _privateAssociations.generate(
_prefAssocSessEnc.getAssociationType(),
_expireIn);
_log.info("Generated private association; handle: "
+ assoc.getHandle());
}
AuthSuccess response = AuthSuccess.createAuthSuccess(
opEndpoint, claimed, id, !isVersion2,
authReq.getReturnTo(),
isVersion2 ? _nonceGenerator.next() : null,
invalidateHandle, assoc, false);
if (_signFields != null)
response.setSignFields(_signFields);
if (_signExtensions != null)
response.setSignExtensions(_signExtensions);
if (signNow)
response.setSignature(assoc.sign(response.getSignedText()));
_log.info("Returning positive assertion for " +
response.getReturnTo());
return response;