blob: 7cf41cc8197b5b97f6cf78579812cd896460d736 (
plain)
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
|
//-----------------------------------------------------------------------
// <copyright file="ServiceProvider.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOAuth {
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
/// <summary>
/// A web application that allows access via OAuth.
/// </summary>
/// <remarks>
/// <para>The Service Provider’s documentation should include:</para>
/// <list>
/// <item>The URLs (Request URLs) the Consumer will use when making OAuth requests, and the HTTP methods (i.e. GET, POST, etc.) used in the Request Token URL and Access Token URL.</item>
/// <item>Signature methods supported by the Service Provider.</item>
/// <item>Any additional request parameters that the Service Provider requires in order to obtain a Token. Service Provider specific parameters MUST NOT begin with oauth_.</item>
/// </list>
/// </remarks>
internal class ServiceProvider {
/// <summary>
/// The field used to store the value of the <see cref="RequestTokenUri"/> property.
/// </summary>
private Uri requestTokenUri;
/// <summary>
/// Gets or sets the URL used to obtain an unauthorized Request Token,
/// described in Section 6.1 (Obtaining an Unauthorized Request Token).
/// </summary>
/// <remarks>
/// The request URL query MUST NOT contain any OAuth Protocol Parameters.
/// This is the URL that <see cref="Messages.RequestTokenMessage"/> messages are directed to.
/// </remarks>
/// <exception cref="ArgumentException">Thrown if this property is set to a URI with OAuth protocol parameters.</exception>
public Uri RequestTokenUri {
get {
return this.requestTokenUri;
}
set {
if (UriUtil.QueryStringContainsOAuthParameters(value)) {
throw new ArgumentException(Strings.RequestUrlMustNotHaveOAuthParameters);
}
this.requestTokenUri = value;
}
}
/// <summary>
/// Gets or sets the URL used to obtain User authorization for Consumer access,
/// described in Section 6.2 (Obtaining User Authorization).
/// </summary>
/// <remarks>
/// This is the URL that <see cref="Messages.DirectUserToServiceProviderMessage"/> messages are
/// indirectly (via the user agent) sent to.
/// </remarks>
public Uri UserAuthorizationUri { get; set; }
/// <summary>
/// Gets or sets the URL used to exchange the User-authorized Request Token
/// for an Access Token, described in Section 6.3 (Obtaining an Access Token).
/// </summary>
/// <remarks>
/// This is the URL that <see cref="Messages.RequestAccessTokenMessage"/> messages are directed to.
/// </remarks>
public Uri AccessTokenUri { get; set; }
}
}
|