1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
//-----------------------------------------------------------------------
// <copyright file="UserAuthorizationRequest.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DotNetOpenAuth.Messaging;
/// <summary>
/// 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).
/// </summary>
[Serializable]
public class UserAuthorizationRequest : MessageBase, ITokenContainingMessage {
/// <summary>
/// Initializes a new instance of the <see cref="UserAuthorizationRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
/// <param name="requestToken">The request token.</param>
/// <param name="version">The OAuth version.</param>
internal UserAuthorizationRequest(MessageReceivingEndpoint serviceProvider, string requestToken, Version version)
: this(serviceProvider, version) {
this.RequestToken = requestToken;
}
/// <summary>
/// Initializes a new instance of the <see cref="UserAuthorizationRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
/// <param name="version">The OAuth version.</param>
internal UserAuthorizationRequest(MessageReceivingEndpoint serviceProvider, Version version)
: base(MessageProtections.None, MessageTransport.Indirect, serviceProvider, version) {
}
/// <summary>
/// Gets or sets the Request or Access Token.
/// </summary>
[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; }
}
/// <summary>
/// Gets the extra, non-OAuth parameters that will be included in the message.
/// </summary>
public new IDictionary<string, string> ExtraData {
get { return base.ExtraData; }
}
/// <summary>
/// Gets a value indicating whether this is a safe OAuth authorization request.
/// </summary>
/// <value><c>true</c> if the Consumer is using OAuth 1.0a or later; otherwise, <c>false</c>.</value>
public bool IsUnsafeRequest {
get { return this.Version < Protocol.V10a.Version; }
}
/// <summary>
/// Gets or sets the Request Token obtained in the previous step.
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
[MessagePart("oauth_token", IsRequired = false)]
internal string RequestToken { get; set; }
/// <summary>
/// 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.
/// </summary>
[MessagePart("oauth_callback", IsRequired = false, MaxVersion = "1.0")]
internal Uri Callback { get; set; }
}
}
|