-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the draft is actually working
- Loading branch information
Showing
10 changed files
with
90 additions
and
31 deletions.
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
42 changes: 42 additions & 0 deletions
42
publisher/src/LeanCode.Pipe/Funnel/ClaimsPrincipalSerializer.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,42 @@ | ||
using System.Security.Claims; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace LeanCode.Pipe.Funnel; | ||
|
||
public class ClaimsPrincipalJsonConverter : JsonConverter<ClaimsPrincipal> | ||
{ | ||
public static ClaimsPrincipalJsonConverter Instance = new(); | ||
|
||
public override ClaimsPrincipal? Read( | ||
ref Utf8JsonReader reader, | ||
Type typeToConvert, | ||
JsonSerializerOptions options | ||
) | ||
{ | ||
var base64 = reader.GetString(); | ||
|
||
if (base64 is null) | ||
{ | ||
return null; | ||
} | ||
|
||
using var ms = new MemoryStream(Convert.FromBase64String(base64)); | ||
using var binaryReader = new BinaryReader(ms); | ||
|
||
return new(binaryReader); | ||
} | ||
|
||
public override void Write( | ||
Utf8JsonWriter writer, | ||
ClaimsPrincipal value, | ||
JsonSerializerOptions options | ||
) | ||
{ | ||
using var ms = new MemoryStream(); | ||
using var binaryWriter = new BinaryWriter(ms); | ||
|
||
value.WriteTo(binaryWriter); | ||
writer.WriteStringValue(Convert.ToBase64String(ms.ToArray())); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
publisher/src/LeanCode.Pipe/Funnel/ExecuteTopicsSubscriptionPipeline.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,9 @@ | ||
using LeanCode.Contracts; | ||
|
||
namespace LeanCode.Pipe.Funnel; | ||
|
||
public record ExecuteTopicsSubscriptionPipeline( | ||
SubscriptionEnvelope Envelope, | ||
OperationType OperationType, | ||
LeanPipeContext Context | ||
); |
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
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
5 changes: 5 additions & 0 deletions
5
publisher/src/LeanCode.Pipe/Funnel/SubscriptionPipelineResult.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,5 @@ | ||
using LeanCode.Contracts; | ||
|
||
namespace LeanCode.Pipe.Funnel; | ||
|
||
public record SubscriptionPipelineResult(SubscriptionStatus Status, List<string> GroupKeys); |
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