Skip to content

Commit

Permalink
Add project and interfaces for SignalR Service SDK (#289)
Browse files Browse the repository at this point in the history
* Add project and interfaces

* Change parameter name for IUserGroupManager

* Remove unnecessary interface

* Remove unnecessary libraries

* stage file

* typo

* Make it async

* Change name

* Modify interface for GenerateAccessToken

* Remove unnecessary package

* Change package name

* Update sln

* Change namespace

* Change comment style

* change using order

* typo

* add interface for ServiceHubContext

* do not package for now

* Remove take access token as input

* Change name from ServiceHubContextBackend to ServiceTransportType

* Only generate client access token

* Make interface

* Comment

* COMMENT UPDATE
  • Loading branch information
wanlwanl authored Dec 24, 2018
1 parent e065bdf commit 6730bbf
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 1 deletion.
9 changes: 8 additions & 1 deletion AzureSignalR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.ChatSample.SelfHostS
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.ChatSample.CSharpClient", "samples\AspNet.ChatSample\AspNet.ChatSample.CSharpClient\AspNet.ChatSample.CSharpClient.csproj", "{38522915-6EA5-4F1D-B6EC-7FE4B178F579}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNet.ChatSample.JavaScriptClient", "samples\AspNet.ChatSample\AspNet.ChatSample.JavaScriptClient\AspNet.ChatSample.JavaScriptClient.csproj", "{5C5D6C13-61BA-48B8-803A-E6A03D31499E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.ChatSample.JavaScriptClient", "samples\AspNet.ChatSample\AspNet.ChatSample.JavaScriptClient\AspNet.ChatSample.JavaScriptClient.csproj", "{5C5D6C13-61BA-48B8-803A-E6A03D31499E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.SignalRService", "src\Microsoft.Azure.SignalRService\Microsoft.Azure.SignalRService.csproj", "{46D902F1-555F-4D82-8D2A-332AA5C0D287}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -104,6 +106,10 @@ Global
{5C5D6C13-61BA-48B8-803A-E6A03D31499E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C5D6C13-61BA-48B8-803A-E6A03D31499E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C5D6C13-61BA-48B8-803A-E6A03D31499E}.Release|Any CPU.Build.0 = Release|Any CPU
{46D902F1-555F-4D82-8D2A-332AA5C0D287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46D902F1-555F-4D82-8D2A-332AA5C0D287}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46D902F1-555F-4D82-8D2A-332AA5C0D287}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46D902F1-555F-4D82-8D2A-332AA5C0D287}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -122,6 +128,7 @@ Global
{CA7F8B59-F1DA-400C-A114-467664C715ED} = {6E50C30D-3ECB-4C66-A579-2528C56924BB}
{38522915-6EA5-4F1D-B6EC-7FE4B178F579} = {6E50C30D-3ECB-4C66-A579-2528C56924BB}
{5C5D6C13-61BA-48B8-803A-E6A03D31499E} = {6E50C30D-3ECB-4C66-A579-2528C56924BB}
{46D902F1-555F-4D82-8D2A-332AA5C0D287} = {DA69F624-5398-4884-87E4-B816698CDE65}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7945A4E4-ACDB-4F6E-95CA-6AC6E7C2CD59}
Expand Down
13 changes: 13 additions & 0 deletions src/Microsoft.Azure.SignalRService/IServiceHubContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Microsoft.AspNetCore.SignalR;

namespace Microsoft.Azure.SignalRService
{
public interface IServiceHubContext: IDisposable, IHubContext<Hub>
{
IUserGroupManager UserGroups { get; }
}
}
17 changes: 17 additions & 0 deletions src/Microsoft.Azure.SignalRService/IServiceManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;

namespace Microsoft.Azure.SignalRService
{
public interface IServiceManager
{
Task<IServiceHubContext> CreateHubContextAsync(string hubName);

string GenerateClientAccessToken(IList<Claim> claims, TimeSpan? lifeTime = null);
}
}
10 changes: 10 additions & 0 deletions src/Microsoft.Azure.SignalRService/IServiceManagerBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.Azure.SignalRService
{
public interface IServiceManagerBuilder
{
IServiceManager Build();
}
}
14 changes: 14 additions & 0 deletions src/Microsoft.Azure.SignalRService/IUserGroupManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.Azure.SignalRService
{
public interface IUserGroupManager
{
Task AddToGroupAsync(string userId, string groupName, CancellationToken cancellationToken = default);
Task RemoveFromGroupAsync(string userId, string groupName, CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- will remove this line when the package is ready -->
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="$(MicrosoftAspNetCoreSignalRPackageVersion)" />
</ItemGroup>

</Project>
28 changes: 28 additions & 0 deletions src/Microsoft.Azure.SignalRService/ServiceHubContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;

namespace Microsoft.Azure.SignalRService
{
internal class ServiceHubContext : IServiceHubContext
{
public IUserGroupManager UserGroups => throw new NotImplementedException();

public IHubClients Clients => throw new NotImplementedException();

public IGroupManager Groups => throw new NotImplementedException();

public void Dispose()
{
throw new NotImplementedException();
}

public Task DisposeAsync()
{
throw new NotImplementedException();
}
}
}
23 changes: 23 additions & 0 deletions src/Microsoft.Azure.SignalRService/ServiceManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;

namespace Microsoft.Azure.SignalRService
{
public class ServiceManager : IServiceManager
{
public Task<IServiceHubContext> CreateHubContextAsync(string hubName)
{
throw new NotImplementedException();
}

public string GenerateClientAccessToken(IList<Claim> claims, TimeSpan? lifeTime = null)
{
throw new NotImplementedException();
}
}
}
26 changes: 26 additions & 0 deletions src/Microsoft.Azure.SignalRService/ServiceManagerBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;

namespace Microsoft.Azure.SignalRService
{
public class ServiceManagerBuilder : IServiceManagerBuilder
{
public ServiceManagerBuilder WithCredentials(string connectionString)
{
throw new NotImplementedException();
}

public ServiceManagerBuilder WithOptions(Action<ServiceManagerOptions> options)
{
throw new NotImplementedException();
}

public IServiceManager Build()
{
throw new NotImplementedException();
}
}
}
10 changes: 10 additions & 0 deletions src/Microsoft.Azure.SignalRService/ServiceManagerOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.Azure.SignalRService
{
public class ServiceManagerOptions
{
public ServiceTransportType ServiceTransportType { get; set; }
}
}
11 changes: 11 additions & 0 deletions src/Microsoft.Azure.SignalRService/ServiceTransportType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.Azure.SignalRService
{
public enum ServiceTransportType
{
Transient,
Persistent
}
}

0 comments on commit 6730bbf

Please sign in to comment.