//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OAuth.Messages { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using DotNetOpenAuth.Messaging; /// /// A message used to redirect the user from a Consumer to a Service Provider's web site /// so the Service Provider can ask the user to authorize the Consumer's access to some /// protected resource(s). /// [Serializable] public class UserAuthorizationRequest : MessageBase, ITokenContainingMessage { /// /// Initializes a new instance of the class. /// /// The URI of the Service Provider endpoint to send this message to. /// The request token. /// The OAuth version. internal UserAuthorizationRequest(MessageReceivingEndpoint serviceProvider, string requestToken, Version version) : this(serviceProvider, version) { this.RequestToken = requestToken; } /// /// Initializes a new instance of the class. /// /// The URI of the Service Provider endpoint to send this message to. /// The OAuth version. internal UserAuthorizationRequest(MessageReceivingEndpoint serviceProvider, Version version) : base(MessageProtections.None, MessageTransport.Indirect, serviceProvider, 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 the extra, non-OAuth parameters that will be included in the message. /// public new IDictionary ExtraData { get { return base.ExtraData; } } /// /// Gets a value indicating whether this is a safe OAuth authorization request. /// /// true if the Consumer is using OAuth 1.0a or later; otherwise, false. public bool IsUnsafeRequest { get { return this.Version < Protocol.V10a.Version; } } /// /// Gets the Request Token obtained in the previous step. /// /// /// The Service Provider MAY declare this parameter as REQUIRED, or /// accept requests to the User Authorization URL without it, in which /// case it will prompt the User to enter it manually. /// [MessagePart("oauth_token", IsRequired = false)] public string RequestToken { get; internal set; } /// /// Gets or sets a URL the Service Provider will use to redirect the User back /// to the Consumer when Obtaining User Authorization is complete. Optional. /// [MessagePart("oauth_callback", IsRequired = false, MaxVersion = "1.0")] internal Uri Callback { get; set; } } }