blob: 150a6a9eef10ceb31fdf614ede41d810826500c2 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
//-----------------------------------------------------------------------
// <copyright file="IAuthorizationDescription.cs" company="Outercurve Foundation">
// Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
/// <summary>
/// Describes a delegated authorization between a resource server, a client, and a user.
/// </summary>
[ContractClass(typeof(IAuthorizationDescriptionContract))]
public interface IAuthorizationDescription {
/// <summary>
/// Gets the identifier of the client authorized to access protected data.
/// </summary>
string ClientIdentifier { get; }
/// <summary>
/// Gets the date this authorization was established or the token was issued.
/// </summary>
/// <value>A date/time expressed in UTC.</value>
DateTime UtcIssued { get; }
/// <summary>
/// Gets the name on the account whose data on the resource server is accessible using this authorization.
/// </summary>
string User { get; }
/// <summary>
/// Gets the scope of operations the client is allowed to invoke.
/// </summary>
HashSet<string> Scope { get; }
}
/// <summary>
/// Code contract for the <see cref="IAuthorizationDescription"/> interface.
/// </summary>
[ContractClassFor(typeof(IAuthorizationDescription))]
internal abstract class IAuthorizationDescriptionContract : IAuthorizationDescription {
/// <summary>
/// Prevents a default instance of the <see cref="IAuthorizationDescriptionContract"/> class from being created.
/// </summary>
private IAuthorizationDescriptionContract() {
}
/// <summary>
/// Gets the identifier of the client authorized to access protected data.
/// </summary>
string IAuthorizationDescription.ClientIdentifier {
get {
Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
throw new NotImplementedException();
}
}
/// <summary>
/// Gets the date this authorization was established or the token was issued.
/// </summary>
/// <value>A date/time expressed in UTC.</value>
DateTime IAuthorizationDescription.UtcIssued {
get { throw new NotImplementedException(); }
}
/// <summary>
/// Gets the name on the account whose data on the resource server is accessible using this authorization.
/// </summary>
string IAuthorizationDescription.User {
get {
Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
throw new NotImplementedException();
}
}
/// <summary>
/// Gets the scope of operations the client is allowed to invoke.
/// </summary>
HashSet<string> IAuthorizationDescription.Scope {
get {
Contract.Ensures(Contract.Result<HashSet<string>>() != null);
throw new NotImplementedException();
}
}
}
}
|