forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserClientSession.cs
More file actions
86 lines (74 loc) · 2.29 KB
/
UserClientSession.cs
File metadata and controls
86 lines (74 loc) · 2.29 KB
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
/*
// $Id: UserClientSession.cs 13369 2010-03-08 19:09:44Z DDNGLOBAL\Demis $
//
// Revision : $Revision: 13369 $
// Modified Date : $LastChangedDate: 2010-03-08 19:09:44 +0000 (Mon, 08 Mar 2010) $
// Modified By : $LastChangedBy: DDNGLOBAL\Demis $
//
// (c) Copyright 2010 Liquidbit Ltd
*/
using System;
using ServiceStack.DesignPatterns.Model;
namespace ServiceStack.ServiceInterface.Deprecated.Session
{
/// <summary>
/// Holds information on a single 'User Client' session.
///
/// A user can have multiple of these client sessions,
/// each from a different web browser or client application.
/// </summary>
public class UserClientSession
: IHasGuidId
{
private const int ValidForTwoWeeks = 14;
/// <summary>
/// Unique Id for this session
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Id of the User for this session
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// If provided stores the clients public key to enable secure transmission
/// </summary>
public string Base64ClientModulus { get; set; }
/// <summary>
/// The unique global and persistent id for the client application.
/// (Can be stored in a persistent cookie)
/// </summary>
public Guid UserClientGlobalId { get; set; }
/// <summary>
/// The IpAddress for the client
/// </summary>
public string IpAddress { get; private set; }
/// <summary>
/// Holds meta-information about the operating environment of this client
/// </summary>
public string UserAgent { get; private set; }
/// <summary>
/// When this client session expires
/// </summary>
public DateTime ExpiryDate { get; set; }
/// <summary>
/// Empty constructor required for TypeSerializer
/// </summary>
public UserClientSession() {}
public UserClientSession(
Guid sessionId,
Guid userId,
string ipAddress,
string userAgent,
string base64ClientModulus,
Guid userClientGlobalId)
{
this.Id = sessionId;
this.UserId = userId;
this.IpAddress = ipAddress;
this.UserAgent = userAgent;
this.Base64ClientModulus = base64ClientModulus;
this.UserClientGlobalId = userClientGlobalId;
this.ExpiryDate = DateTime.UtcNow.AddDays(ValidForTwoWeeks);
}
}
}