Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added volumes to Docker Compose.
- Volumes to Docker Compose.

### Fixed

- ClaimHelper UTC conversion.

## [1.20.0] - 2024-11-19

Expand Down
2 changes: 1 addition & 1 deletion src/Logitar.Security/Claims/ClaimHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class ClaimHelper
/// <returns>The created claim.</returns>
public static Claim Create(string name, DateTime moment)
{
string value = new DateTimeOffset(moment.ToUniversalTime()).ToUnixTimeSeconds().ToString();
string value = new DateTimeOffset(moment.AsUniversalTime()).ToUnixTimeSeconds().ToString();

return new Claim(name, value, ClaimValueTypes.Integer64);
}
Expand Down
4 changes: 4 additions & 0 deletions src/Logitar.Security/Logitar.Security.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Logitar\Logitar.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="LICENSE">
<Pack>True</Pack>
Expand Down
4 changes: 2 additions & 2 deletions tests/Logitar.Security.UnitTests/Claims/ClaimHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void It_should_create_the_correct_claim_from_a_date_and_time()
Assert.Equal(value, local.Value);
Assert.Equal(ClaimValueTypes.Integer64, local.ValueType);

Claim utc = ClaimHelper.Create(name, moment.ToUniversalTime());
Claim utc = ClaimHelper.Create(name, moment.AsUniversalTime());
Assert.Equal(local.Type, utc.Type);
Assert.Equal(local.Value, utc.Value);
Assert.Equal(local.ValueType, utc.ValueType);
Expand All @@ -30,7 +30,7 @@ public void It_should_create_the_correct_claim_from_an_unspecified_kind_date_and
Claim claim = ClaimHelper.Create(Rfc7519ClaimNames.ExpirationTime, unspecified);
DateTime value = ClaimHelper.ExtractDateTime(claim);
Assert.Equal(DateTimeKind.Utc, value.Kind);
Assert.Equal(ToUnixTimeSeconds(local), ToUnixTimeSeconds(value));
Assert.Equal(ToUnixTimeSeconds(unspecified.AsUniversalTime()), ToUnixTimeSeconds(value));
}

[Fact(DisplayName = "It should extract the correct date and time from a claim.")]
Expand Down
Loading