summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/Code/Constants.cs
blob: 9115f1c36ea7cc1fb936c65460ea17af1d88617d (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
namespace OAuthServiceProvider.Code {
	using System;
	using DotNetOpenAuth.Messaging;
	using DotNetOpenAuth.OAuth;
	using DotNetOpenAuth.OAuth.ChannelElements;

	/// <summary>
	/// Service Provider definitions.
	/// </summary>
	public static class Constants {
		public static Uri WebRootUrl { get; set; }

		public static ServiceProviderHostDescription SelfDescription {
			get {
				var description = new ServiceProviderHostDescription {
					AccessTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
					RequestTokenEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
					UserAuthorizationEndpoint = new MessageReceivingEndpoint(new Uri(WebRootUrl, "/OAuth.ashx"), HttpDeliveryMethods.PostRequest),
					TamperProtectionElements = new ITamperProtectionChannelBindingElement[] {
					new HmacSha1SigningBindingElement(),
				},
				};

				return description;
			}
		}

		public static ServiceProvider CreateServiceProvider() {
			return new ServiceProvider(SelfDescription, Global.TokenManager, Global.NonceStore);
		}
	}
}