-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add project and interfaces for SignalR Service SDK (#289)
* 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
Showing
11 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
src/Microsoft.Azure.SignalRService/IServiceManagerBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Microsoft.Azure.SignalRService/Microsoft.Azure.SignalRService.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
26
src/Microsoft.Azure.SignalRService/ServiceManagerBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
src/Microsoft.Azure.SignalRService/ServiceManagerOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
11
src/Microsoft.Azure.SignalRService/ServiceTransportType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |