aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokensManager.cs
blob: 06796c41ea38f0bbfa0d8c957668cc62d0d14bb6 (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
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Tango.Web.Security;
using Tango.Web.Storage;

namespace Tango.MachineService.Security
{
    public class RefreshTokensManager<T> where T : class
    {
        private TableStorageManager _manager;

        public RefreshTokensManager()
        {
            _manager = new TableStorageManager();
        }

        public RefreshTokenEntity<T> GetToken(String refreshToken)
        {
            var table = _manager.GetTable(MachineServiceConfig.REFRESH_TOKENS_TABLE_NAME);
            return table.GetEntity<RefreshTokenEntity<T>>(MachineServiceConfig.REFRESH_TOKENS_TABLE_PARTITION, refreshToken);
        }

        public RefreshTokenEntity<T> InsertOrUpdate(RefreshTokenEntity<T> refreshTokenEntity)
        {
            var table = _manager.GetTable(MachineServiceConfig.REFRESH_TOKENS_TABLE_NAME);
            return table.InsertOrUpdateEntity(refreshTokenEntity);
        }

        public void DeleteToken(RefreshTokenEntity<T> entity)
        {
            var table = _manager.GetTable(MachineServiceConfig.REFRESH_TOKENS_TABLE_NAME);
            table.DeleteEntity(entity);
        }
    }
}
DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> </Reference> <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> </Reference> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Web.DynamicData" /> <Reference Include="System.Web.Entity" /> <Reference Include="System.Web.ApplicationServices" /> <Reference Include="System" /> <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.EnterpriseServices" /> <Reference Include="System.Runtime.Serialization" /> <Reference Include="System.ServiceModel" /> <Reference Include="System.ServiceModel.Web" /> <Reference Include="System.Web" /> <Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Services" /> <Reference Include="System.Xml" /> <Reference Include="System.Xml.Linq" /> </ItemGroup> <ItemGroup> <Content Include="MachineStudioUpdateService.svc" /> <Content Include="Web.config" /> </ItemGroup> <ItemGroup> <Compile Include="..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="MachineStudioUpdateService.svc.cs"> <DependentUpon>MachineStudioUpdateService.svc</DependentUpon> </Compile> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <Folder Include="App_Data\" /> </ItemGroup> <ItemGroup> <Content Include="packages.config" /> <None Include="Properties\PublishProfiles\Publish To Twine Local Via FTP.pubxml" /> <None Include="Web.Debug.config"> <DependentUpon>Web.config</DependentUpon> </None> <None Include="Web.Release.config"> <DependentUpon>Web.config</DependentUpon> </None> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> </ProjectReference> <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> </ProjectReference> <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> </ProjectReference> <ProjectReference Include="..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj"> <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> </ItemGroup> <PropertyGroup> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <WebProjectProperties> <UseIIS>False</UseIIS> <AutoAssignPort>True</AutoAssignPort> <DevelopmentServerPort>65206</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:53044/</IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> </CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> </FlavorProperties> <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>