示例#1
0
        public static EncodableResponse CreateAssertion(CheckIdRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            if (!request.IsAuthenticated.HasValue)
            {
                throw new InvalidOperationException();
            }
            EncodableResponse response = EncodableResponse.PrepareIndirectMessage(
                request.Protocol, request.ReturnTo, request.AssociationHandle);

            if (request.IsAuthenticated.Value)
            {
                AssertionMessage.CreatePositiveAssertion(response, request.Provider,
                                                         request.LocalIdentifier, request.ClaimedIdentifier);
                Logger.InfoFormat("Created positive assertion for {0}.", request.ClaimedIdentifier);
            }
            else
            {
                AssertionMessage.CreateNegativeAssertion(response, request);
                Logger.InfoFormat("Created negative assertion for {0}.", request.ClaimedIdentifier);
            }
            return(response);
        }
示例#2
0
        /// <summary>
        /// Allows a Provider to send an identity assertion on behalf of one
        /// of its members in order to redirect the member to a relying party
        /// web site and log him/her in immediately in one uninterrupted step.
        /// </summary>
        /// <param name="relyingParty">
        /// The URL of the relying party web site.
        /// This will typically be the home page, but may be a longer URL if
        /// that Relying Party considers the scope of its realm to be more specific.
        /// The URL provided here must allow discovery of the Relying Party's
        /// XRDS document that advertises its OpenID RP endpoint.
        /// </param>
        /// <param name="claimedIdentifier">
        /// The Identifier you are asserting your member controls.
        /// </param>
        /// <param name="localIdentifier">
        /// The Identifier you know your user by internally.  This will typically
        /// be the same as <paramref name="claimedIdentifier"/>.
        /// </param>
        /// <returns>
        /// An <see cref="IResponse"/> object describing the HTTP response to send
        /// the user agent to allow the redirect with assertion to happen.
        /// </returns>
        public IResponse PrepareUnsolicitedAssertion(Realm relyingParty,
                                                     Identifier claimedIdentifier, Identifier localIdentifier)
        {
            if (relyingParty == null)
            {
                throw new ArgumentNullException("relyingParty");
            }
            if (claimedIdentifier == null)
            {
                throw new ArgumentNullException("claimedIdentifier");
            }
            if (localIdentifier == null)
            {
                throw new ArgumentNullException("localIdentifier");
            }

            Logger.InfoFormat("Preparing unsolicited assertion for {0}", claimedIdentifier);
            return(AssertionMessage.CreateUnsolicitedAssertion(this,
                                                               relyingParty, claimedIdentifier, localIdentifier));
        }
示例#3
0
 protected override IEncodable CreateResponse()
 {
     Debug.Assert(IsAuthenticated.HasValue, "This should be checked internally before CreateResponse is called.");
     return(AssertionMessage.CreateAssertion(this));
 }