mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Add unit test to verify handling of missing client in session coordination
Ensure `DefaultSessionCoordinationService` does not attempt logout for missing or null clients by introducing a dedicated test.
This commit is contained in:
parent
c908d15677
commit
463518332e
1 changed files with 39 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
|||
using System.Threading.Tasks;
|
||||
using Duende.IdentityServer.Configuration;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Duende.IdentityServer.Stores;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Shouldly;
|
||||
using UnitTests.Endpoints.EndSession;
|
||||
using Xunit;
|
||||
|
||||
namespace UnitTests.Services.Default;
|
||||
|
||||
public class DefaultSessionCoordinationServiceTests
|
||||
{
|
||||
public DefaultSessionCoordinationService Service;
|
||||
|
||||
[Fact]
|
||||
public async Task Handles_missing_client_null_reference()
|
||||
{
|
||||
var stubBackChannelLogoutClient = new StubBackChannelLogoutClient();
|
||||
Service = new DefaultSessionCoordinationService(
|
||||
new IdentityServerOptions(),
|
||||
new InMemoryPersistedGrantStore(),
|
||||
new InMemoryClientStore([]),
|
||||
stubBackChannelLogoutClient,
|
||||
new NullLogger<DefaultSessionCoordinationService>());
|
||||
|
||||
await Service.ProcessExpirationAsync(new UserSession
|
||||
{
|
||||
ClientIds = ["not_found"],
|
||||
SessionId = "1",
|
||||
SubjectId = "1"
|
||||
});
|
||||
|
||||
stubBackChannelLogoutClient
|
||||
.SendLogoutsWasCalled
|
||||
.ShouldBeFalse();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue