summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth/Protocol.cs
blob: be76e2a6fef09be7f2e2ba5322f1db5cf4213e3e (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
72
73
74
75
//-----------------------------------------------------------------------
// <copyright file="Protocol.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOAuth {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using DotNetOAuth.Messaging;

	/// <summary>
	/// Constants used in the OAuth protocol.
	/// </summary>
	/// <remarks>
	/// OAuth Protocol Parameter names and values are case sensitive. Each OAuth Protocol Parameters MUST NOT appear more than once per request, and are REQUIRED unless otherwise noted,
	/// per OAuth 1.0 section 5.
	/// </remarks>
	internal class Protocol {
		/// <summary>
		/// Gets the default <see cref="Protocol"/> instance.
		/// </summary>
		internal static Protocol Default { get { return V10; } }

		/// <summary>
		/// The namespace to use for V1.0 of the protocol.
		/// </summary>
		internal const string DataContractNamespaceV10 = "http://oauth.net/core/1.0/";

		/// <summary>
		/// Gets the <see cref="Protocol"/> instance with values initialized for V1.0 of the protocol.
		/// </summary>
		internal static readonly Protocol V10 = new Protocol {
			dataContractNamespace = DataContractNamespaceV10,
		};

		/// <summary>
		/// The namespace to use for this version of the protocol.
		/// </summary>
		private string dataContractNamespace;

		/// <summary>
		/// The prefix used for all key names in the protocol.
		/// </summary>
		private string parameterPrefix = "oauth_";

		/// <summary>
		/// The scheme to use in Authorization header message requests.
		/// </summary>
		private string authorizationHeaderScheme = "OAuth";

		/// <summary>
		/// Gets the namespace to use for this version of the protocol.
		/// </summary>
		internal string DataContractNamespace {
			get { return this.dataContractNamespace; }
		}

		/// <summary>
		/// Gets the prefix used for all key names in the protocol.
		/// </summary>
		internal string ParameterPrefix {
			get { return this.parameterPrefix; }
		}

		/// <summary>
		/// Gets the scheme to use in Authorization header message requests.
		/// </summary>
		internal string AuthorizationHeaderScheme {
			get { return this.authorizationHeaderScheme; }
		}
	}
}