summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId/Extensions/AttributeExchange/AttributeValues.cs
blob: 19abc657fd5e8ffebcc0470d783be10a6eb50364 (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
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace DotNetOpenId.Extensions.AttributeExchange {
	/// <summary>
	/// An individual attribute's value(s) as supplied by an OpenID Provider
	/// in response to a prior request by an OpenID Relying Party as part of
	/// a fetch request, or by a relying party as part of a store request.
	/// </summary>
	[Serializable]
	public class AttributeValues {
		/// <remarks>
		/// This is internal because web sites should be using the 
		/// <see cref="AttributeRequest.Respond"/> method to instantiate.
		/// </remarks>
		internal AttributeValues() {
			Values = new List<string>(1);
		}
		internal AttributeValues(string typeUri) {
			if (string.IsNullOrEmpty(typeUri)) throw new ArgumentNullException("typeUri");
			TypeUri = typeUri;
			Values = new List<string>(1);
		}
		/// <summary>
		/// Instantiates an <see cref="AttributeValues"/> object.
		/// </summary>
		public AttributeValues(string typeUri, params string[] values) {
			if (string.IsNullOrEmpty(typeUri)) throw new ArgumentNullException("typeUri");
			TypeUri = typeUri;
			Values = values ?? new string[0];
		}

		/// <summary>
		/// The URI uniquely identifying the attribute whose value is being supplied.
		/// </summary>
		public string TypeUri { get; internal set; }

		/// <summary>
		/// Gets the values supplied by the Provider.
		/// </summary>
		public IList<string> Values { get; private set; }
	}
}