summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth/ServiceProviderEndpoint.cs
blob: 89f5e615a246acf6195a7742b6acd30fded123cc (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
//-----------------------------------------------------------------------
// <copyright file="ServiceProviderEndpoint.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>
	/// A description of an individual endpoint on a Service Provider.
	/// </summary>
	public class ServiceProviderEndpoint {
		/// <summary>
		/// Initializes a new instance of the <see cref="ServiceProviderEndpoint"/> class.
		/// </summary>
		/// <param name="locationUri">The URL of this Service Provider endpoint.</param>
		/// <param name="method">The HTTP method(s) allowed.</param>
		public ServiceProviderEndpoint(string locationUri, HttpDeliveryMethod method)
			: this(new Uri(locationUri), method) { }

		/// <summary>
		/// Initializes a new instance of the <see cref="ServiceProviderEndpoint"/> class.
		/// </summary>
		/// <param name="location">The URL of this Service Provider endpoint.</param>
		/// <param name="method">The HTTP method(s) allowed.</param>
		public ServiceProviderEndpoint(Uri location, HttpDeliveryMethod method) {
			if (location == null) {
				throw new ArgumentNullException("location");
			}
			if (method == HttpDeliveryMethod.None) {
				throw new ArgumentOutOfRangeException("method");
			}

			this.Location = location;
			this.AllowedMethods = method;
		}

		/// <summary>
		/// Gets or sets the URL of this Service Provider endpoint.
		/// </summary>
		public Uri Location { get; set; }

		/// <summary>
		/// Gets or sets the HTTP method(s) allowed.
		/// </summary>
		public HttpDeliveryMethod AllowedMethods { get; set; }
	}
}