-
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.
- Loading branch information
Showing
47 changed files
with
714 additions
and
400 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
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
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
23 changes: 23 additions & 0 deletions
23
lib/Logitar.Identity.Infrastructure/Converters/ApiKeyIdConverter.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,23 @@ | ||
using Logitar.EventSourcing; | ||
using Logitar.Identity.Core.ApiKeys; | ||
|
||
namespace Logitar.Identity.Infrastructure.Converters; | ||
|
||
public class ApiKeyIdConverter : JsonConverter<ApiKeyId> | ||
{ | ||
public override ApiKeyId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
string? value = reader.GetString(); | ||
if (string.IsNullOrWhiteSpace(value)) | ||
{ | ||
return new ApiKeyId(); | ||
} | ||
StreamId streamId = new(value); | ||
return new(streamId); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, ApiKeyId apiKeyId, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(apiKeyId.Value); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
lib/Logitar.Identity.Infrastructure/Converters/CustomIdentifierConverter.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,16 @@ | ||
using Logitar.Identity.Core; | ||
|
||
namespace Logitar.Identity.Infrastructure.Converters; | ||
|
||
public class CustomIdentifierConverter : JsonConverter<CustomIdentifier> | ||
{ | ||
public override CustomIdentifier? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
return CustomIdentifier.TryCreate(reader.GetString()); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, CustomIdentifier customIdentifier, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(customIdentifier.Value); | ||
} | ||
} |
Oops, something went wrong.