summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AutomatedAuthorizationCheckResponse.cs
blob: f644f09fe900edf223f423b65692864d5f41edb3 (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
//-----------------------------------------------------------------------
// <copyright file="AutomatedAuthorizationCheckResponse.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.OAuth2 {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using DotNetOpenAuth.OAuth2.Messages;
	using Validation;

	/// <summary>
	/// Describes the result of an automated authorization check, such as for client credential or resource owner password grants.
	/// </summary>
	public class AutomatedAuthorizationCheckResponse {
		/// <summary>
		/// Initializes a new instance of the <see cref="AutomatedAuthorizationCheckResponse" /> class.
		/// </summary>
		/// <param name="accessRequest">The access token request.</param>
		/// <param name="approved">A value indicating whether the authorization should be approved.</param>
		public AutomatedAuthorizationCheckResponse(IAccessTokenRequest accessRequest, bool approved) {
			Requires.NotNull(accessRequest, "accessRequest");

			this.IsApproved = approved;
			this.ApprovedScope = new HashSet<string>(accessRequest.Scope);
		}

		/// <summary>
		/// Gets a value indicating whether the authorization should be approved.
		/// </summary>
		public bool IsApproved { get; private set; }

		/// <summary>
		/// Gets the scope to be granted.
		/// </summary>
		public HashSet<string> ApprovedScope { get; private set; }
	}
}