//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OpenId.Messages { using System; using System.Collections.Generic; using System.Linq; using System.Text; using DotNetOpenAuth.OpenId.ChannelElements; using DotNetOpenAuth.OpenId.Provider; using Validation; /// /// The check_auth response message, as it is seen by the OpenID Provider. /// internal class CheckAuthenticationResponseProvider : CheckAuthenticationResponse { /// /// Initializes a new instance of the class. /// /// The request that this message is responding to. /// The OpenID Provider that is preparing to send this response. internal CheckAuthenticationResponseProvider(CheckAuthenticationRequest request, OpenIdProvider provider) : base(request.Version, request) { Requires.NotNull(provider, "provider"); // The channel's binding elements have already set the request's IsValid property // appropriately. We just copy it into the response message. this.IsValid = request.IsValid; // Confirm the RP should invalidate the association handle only if the association // is not valid (any longer). OpenID 2.0 section 11.4.2.2. IndirectSignedResponse signedResponse = new IndirectSignedResponse(request, provider.Channel); string invalidateHandle = ((ITamperResistantOpenIdMessage)signedResponse).InvalidateHandle; if (!string.IsNullOrEmpty(invalidateHandle) && !provider.AssociationStore.IsValid(signedResponse, false, invalidateHandle)) { this.InvalidateHandle = invalidateHandle; } } } }