This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4k
/
IsActiveContext.cs
64 lines (55 loc) · 1.88 KB
/
IsActiveContext.cs
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
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using IdentityServer4.Extensions;
using System;
using System.Security.Claims;
namespace IdentityServer4.Models
{
/// <summary>
/// Context describing the is-active check
/// </summary>
public class IsActiveContext
{
/// <summary>
/// Initializes a new instance of the <see cref="IsActiveContext"/> class.
/// </summary>
public IsActiveContext(ClaimsPrincipal subject, Client client, string caller)
{
if (subject == null) throw new ArgumentNullException(nameof(subject));
if (client == null) throw new ArgumentNullException(nameof(client));
if (caller.IsMissing()) throw new ArgumentNullException(nameof(caller));
Subject = subject;
Client = client;
Caller = caller;
IsActive = true;
}
/// <summary>
/// Gets or sets the subject.
/// </summary>
/// <value>
/// The subject.
/// </value>
public ClaimsPrincipal Subject { get; set; }
/// <summary>
/// Gets or sets the client.
/// </summary>
/// <value>
/// The client.
/// </value>
public Client Client { get; set; }
/// <summary>
/// Gets or sets the caller.
/// </summary>
/// <value>
/// The caller.
/// </value>
public string Caller { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the subject is active and can recieve tokens.
/// </summary>
/// <value>
/// <c>true</c> if the subject is active; otherwise, <c>false</c>.
/// </value>
public bool IsActive { get; set; }
}
}