aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Web/LoginResponse.cs
blob: 4ae22fa93597a5f8417fa328a4ebd2f3f43b47ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;
using Tango.Transport.Web;
using Tango.Web.Security;

namespace Tango.MachineStudio.Common.Web
{
    public class LoginResponse : WebTokenResponse
    {
        public DataSource DataSource { get; set; }
        public bool VersionChangeRequired { get; set; }
        public String RequiredVersion { get; set; }
    }
}
ass="n">storageAccount.CreateCloudTableClient(); var table = client.GetTableReference("Tokens"); table.CreateIfNotExists(); return table; } public void AddToken(String token, String identity, DateTime expiration) { var table = 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)); } } }