//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OAuth.Messages { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using DotNetOpenAuth.Messaging; /// /// A direct message sent from Service Provider to Consumer in response to /// a Consumer's request. /// public class UnauthorizedTokenResponse : MessageBase, ITokenSecretContainingMessage { /// /// Initializes a new instance of the class. /// /// The unauthorized request token message that this message is being generated in response to. /// The request token. /// The token secret. /// /// This constructor is used by the Service Provider to send the message. /// protected internal UnauthorizedTokenResponse(UnauthorizedTokenRequest requestMessage, string requestToken, string tokenSecret) : this(requestMessage, requestMessage.Version) { Requires.NotNull(requestToken, "requestToken"); Requires.NotNull(tokenSecret, "tokenSecret"); this.RequestToken = requestToken; this.TokenSecret = tokenSecret; } /// /// Initializes a new instance of the class. /// /// The originating request. /// The OAuth version. /// This constructor is used by the consumer to deserialize the message. protected internal UnauthorizedTokenResponse(UnauthorizedTokenRequest originatingRequest, Version version) : base(MessageProtections.None, originatingRequest, version) { } /// /// Gets or sets the Request or Access Token. /// [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Justification = "This property IS accessible by a different name.")] string ITokenContainingMessage.Token { get { return this.RequestToken; } set { this.RequestToken = value; } } /// /// Gets or sets the Request or Access Token secret. /// string ITokenSecretContainingMessage.TokenSecret { get { return this.TokenSecret; } set { this.TokenSecret = value; } } /// /// Gets the extra, non-OAuth parameters that will be included in the message. /// public new IDictionary ExtraData { get { return base.ExtraData; } } /// /// Gets or sets the Request Token. /// [MessagePart("oauth_token", IsRequired = true)] internal string RequestToken { get; set; } /// /// Gets the original request for an unauthorized token. /// internal UnauthorizedTokenRequest RequestMessage { get { return (UnauthorizedTokenRequest)this.OriginatingRequest; } } /// /// Gets or sets the Token Secret. /// [MessagePart("oauth_token_secret", IsRequired = true)] protected internal string TokenSecret { get; set; } /// /// Gets a value indicating whether the Service Provider recognized the callback parameter in the request. /// [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Message serialization invoked.")] [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Message parts must be instance members.")] [MessagePart("oauth_callback_confirmed", IsRequired = true, MinVersion = Protocol.V10aVersion)] private bool CallbackConfirmed { get { return true; } } } }