-
Notifications
You must be signed in to change notification settings - Fork 1
/
NeoUserClaim.cs
69 lines (60 loc) · 1.89 KB
/
NeoUserClaim.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
65
66
67
68
69
namespace Neo4j.AspNet.Identity
{
using System;
using System.Security.Claims;
using Newtonsoft.Json;
/// <summary>
/// Claims for a <see cref="NeoUser"/>.
/// </summary>
public class NeoUserClaim
{
/// <summary>
/// The name of the relationship for a user who owns a claim.
/// </summary>
public const string RelationHasClaim = "HAS_CLAIM";
/// <summary>
/// The claim node label.
/// </summary>
public const string ClaimNodeLabel = "claim";
/// <summary>
/// The claim node cypher match clause.
/// </summary>
internal const string ClaimNodeMatch = "(c:" + NeoUserClaim.ClaimNodeLabel + ")";
/// <summary>
/// Initializes a new instance of the <see cref="NeoUserClaim"/> class.
/// </summary>
public NeoUserClaim()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="NeoUserClaim"/> class.
/// </summary>
public NeoUserClaim(Claim claim)
{
this.ClaimType = claim.Type;
this.ClaimValue = claim.Value;
}
/// <summary>
/// Gets or sets the type of the claim.
/// </summary>
[JsonProperty("type")]
public virtual string ClaimType { get; set; }
/// <summary>
/// Gets or sets the claim value.
/// </summary>
[JsonProperty("value")]
public virtual string ClaimValue { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
[JsonProperty("id")]
public virtual string Id { get; set; }
/// <summary>
/// Converts this <see cref="NeoUserClaim"/> to a <see cref="Claim"/>.
/// </summary>
public Claim ToClaim()
{
return new Claim(this.ClaimType, this.ClaimValue);
}
}
}