Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,7 @@ public async Task GetAndRemoveExpiredSessions_WhenExpiredSessionsExist_AndExceed
actual.Should().Contain(x => x.Key == expiredSession0.Key);
actual.Should().Contain(x => x.Key == expiredSession1.Key);
}

//TODO: Finish implementing test

[Theory, MemberData(nameof(TestDatabaseProviders))]
public async Task GetAndRemoveExpiredSessions_WhenUnspecifiedTimezoneInDbEntities_ShouldBeTreatedAsUtc(DbContextOptions<PersistedGrantDbContext> options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ public interface IUserSessionEventsService
/// Triggered when the session logout occurs
/// </summary>
/// <param name="sessionEventContext">context needed for handling logout event</param>
/// <returns></returns>
public Task HandleUserSessionLogout(EndUserSessionEventContext sessionEventContext);

/// <summary>
/// Triggered when the session expires
/// </summary>
/// <param name="sessionEventContext">context needed for handling logout event</param>
/// <returns></returns>
public Task HandleUserSessionExpiry(EndUserSessionEventContext sessionEventContext);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,14 @@

namespace Open.IdentityServer.Validation;

/// <summary>
///
/// </summary>
/// <param name="decorator"></param>
/// <param name="userSessionEventsService"></param>
/// <param name="telemetry"></param>
internal class DefaultServerSideSessionTokenValidator(
Decorator<ITokenValidator> decorator,
IUserSessionEventsService userSessionEventsService,
ITelemetryService telemetry): ITokenValidator
{
private ITokenValidator decoratedService = decorator?.Instance ?? throw new ArgumentNullException(nameof(decorator));

/// <summary>
///
/// </summary>
/// <param name="token"></param>
/// <param name="expectedScope"></param>
/// <returns></returns>
/// <inheritdoc />
public async Task<TokenValidationResult?> ValidateAccessTokenAsync(string token, string? expectedScope = null)
{
using ITrace? trace = telemetry.Trace(TelemetryConstants.TraceCategories.Validation, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,6 @@ public async Task FilterSessions_WhenSessionMatch_ShouldReturnMatchingSessions()
actual.Should().Contain(x => x.Key == "key-1");
actual.Should().Contain(x => x.Key == "key-6");
}

/// TODO: implement filter with query tests, types of query to test
/// 1. When no filter is provided, should use default values
/// 2. When no token is provided, it should get the first page of results
/// 3. When a token is provided, it should get the next page relative to the provided token
/// 4. When a subjectId filter is provided, it should filter the results using it
/// 5. When a sessionId filter is provided, it should filter results using it
/// 6. When a display name filter is provided, it should filter results using it

[Fact]
public async Task FilterSessions_WithQuery_WhenNoResults_ShouldEmptyResultsSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,5 @@ public async Task PublicMethods_WithCustomisedLogic_WhenCalled_ShouldTelemetryTr
TelemetryConstants.TraceCategories.Validation, sut, method.traceMethodName), Times.Once);
Mock.Get(trace).Verify(t => t.Dispose(), Times.Once);
}

// Assert all methods covered
// typeof(DefaultServerSideSessionRefreshTokenService).GetMethods()
// .Where(m => m is { IsPublic: true, IsStatic: false, IsSpecialName: false })
// .Where(m => m.DeclaringType == typeof(DefaultServerSideSessionRefreshTokenService))
// .Select(m => m.Name)
// .Distinct()
// .Should().BeEquivalentTo(methods.Select(m => m.traceMethodName));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,5 @@ public async Task PublicMethods_WithCustomisedLogic_WhenCalled_ShouldTelemetryTr
TelemetryConstants.TraceCategories.Validation, sut, method.traceMethodName), Times.Once);
Mock.Get(trace).Verify(t => t.Dispose(), Times.Once);
}

// Assert all methods covered
// typeof(DefaultServerSideSessionTokenValidator).GetMethods()
// .Where(m => m is { IsPublic: true, IsStatic: false, IsSpecialName: false })
// .Where(m => m.DeclaringType == typeof(DefaultServerSideSessionTokenValidator))
// .Select(m => m.Name)
// .Distinct()
// .Should().BeEquivalentTo(methods.Select(m => m.traceMethodName));
}
}
Loading