aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Security/TokenManager.cs
blob: abd6156860aa9f494ffd9eea7ca60156696f85d9 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;

namespace Tango.MachineStudio.UI.TFS
{
    public class SystemInformationModel
    {
        public String ApplicationVersion { get; set; }
        public String EmbeddedVersion { get; set; }
        public String UserName { get; set; }
        public String HostName { get; set; }
        public Machine Machine { get; set; }
        public String ConfigurationString { get; set; }
        public String LoadedHardwareConfigurationString { get; set; }
        public String LoadedProcessParametersString { get; set; }
    }
}
w"> GetTokensTable(); table.Execute(TableOperation.InsertOrReplace(new TokenEntity() { PartitionKey = MachineServiceConfig.REFRESH_TOKENS_TABLE_PARTITION, RowKey = Guid.NewGuid().ToString(), AccessToken = token, Identity = identity, Expiration = expiration, })); } public void UpdateToken(String oldToken, String newToken, DateTime expiration) { var table = GetTokensTable(); var existingToken = table.CreateQuery<TokenEntity>().AsQueryable().Where(x => x.AccessToken == oldToken).ToList().FirstOrDefault(); if (existingToken == null) { throw new AuthenticationException("Invalid token."); } existingToken.AccessToken = newToken; existingToken.Expiration = expiration; table.Execute(TableOperation.InsertOrMerge(existingToken)); } } }