Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.ComponentModel.DataAnnotations;
11 : using System.Runtime.Serialization;
12 : using Cqrs.DataStores;
13 :
14 : namespace Cqrs.Authentication
15 : {
16 : /// <summary>
17 : /// This is a <see cref="ISingleSignOnToken"/> that includes an identifiable <see cref="CompanyRsn"/> to optimise the hits of the <see cref="IDataStore{TData}">DataStores</see> by including data you most likely need.
18 : /// As such, if not used correctly, this can expose identifiable information.
19 : /// It is suggested the service layer populates this before sending commands as part of authorisation/authentication.
20 : /// </summary>
21 : public class SingleSignOnTokenWithCompanyRsn : SingleSignOnToken, ISingleSignOnTokenWithCompanyRsn
22 1 : {
23 : /// <summary>
24 : /// The Rsn of the company the user doing the operation is operating on.
25 : /// When used in a system where a single user can have access to multiple companies, this is not the company the user belongs to, but the company it is operating on.
26 : /// When used by an external 3rd party this is the all in context of the person being impersonated, not the 3rd party system itself.
27 : /// </summary>
28 : [Required]
29 : [DataMember]
30 : public Guid CompanyRsn { get; set; }
31 :
32 : /// <summary>
33 : /// Returns <see cref="CompanyRsn"/>.
34 : /// </summary>
35 : /// <returns><see cref="CompanyRsn"/>.</returns>
36 1 : public override string Serialise()
37 : {
38 : return CompanyRsn.ToString("N");
39 : }
40 : }
41 : }
|