summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/App_Code/Constants.cs
blob: 7780e968feb73479b36b5156fad439d5d40e4809 (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
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 ServiceProviderDescription SelfDescription {
		get {
			ServiceProviderDescription description = new ServiceProviderDescription {
				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);
	}
}