summaryrefslogtreecommitdiffstats
path: root/projecttemplates/RelyingPartyLogic/Model.Consumer.cs
blob: 258a248f0ac7f5128f10f2900ce43516e378c19f (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
//-----------------------------------------------------------------------
// <copyright file="Model.Consumer.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace RelyingPartyLogic {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Security.Cryptography.X509Certificates;
	using System.Web;
	using DotNetOpenAuth.OAuth;
	using DotNetOpenAuth.OAuth.ChannelElements;

	public partial class Consumer : IConsumerDescription, DotNetOpenAuth.OAuth2.IConsumerDescription {
		public VerificationCodeFormat VerificationCodeFormat {
			get { return (VerificationCodeFormat)this.VerificationCodeFormatAsInt; }
			set { this.VerificationCodeFormatAsInt = (int)value; }
		}

		public X509Certificate2 Certificate {
			get { return this.X509CertificateAsBinary != null ? new X509Certificate2(this.X509CertificateAsBinary) : null; }
			set { this.X509CertificateAsBinary = value != null ? value.RawData : null; }
		}

		public Uri Callback {
			get { return this.CallbackAsString != null ? new Uri(this.CallbackAsString) : null; }
			set { this.CallbackAsString = value != null ? value.AbsoluteUri : null; }
		}

		string IConsumerDescription.Secret {
			get { return this.ConsumerSecret; }
		}

		string IConsumerDescription.Key {
			get { return this.ConsumerKey; }
		}

		#region IConsumerDescription Members

		/// <summary>
		/// Gets the consumer secret.
		/// </summary>
		string DotNetOpenAuth.OAuth2.IConsumerDescription.Secret {
			get { return this.ConsumerSecret; }
		}

		#endregion
	}
}