/// <summary> /// Ctor. /// </summary> public DefaultSessionManagementService( IServerSideTicketService serverSideTicketService, IServerSideSessionStore serverSideSessionStore, IPersistedGrantStore persistedGrantStore, IBackChannelLogoutService backChannelLogoutService) { _serverSideTicketService = serverSideTicketService; _serverSideSessionStore = serverSideSessionStore; _persistedGrantStore = persistedGrantStore; _backChannelLogoutService = backChannelLogoutService; }
/// <summary> /// ctor /// </summary> /// <param name="options"></param> /// <param name="issuerNameService"></param> /// <param name="store"></param> /// <param name="dataProtectionProvider"></param> /// <param name="logger"></param> public ServerSideTicketService( IdentityServerOptions options, IIssuerNameService issuerNameService, IServerSideSessionStore store, IDataProtectionProvider dataProtectionProvider, ILogger <ServerSideTicketService> logger) { _options = options; _issuerNameService = issuerNameService; _store = store; _protector = dataProtectionProvider.CreateProtector("Duende.SessionManagement.ServerSideTicketStore"); _logger = logger; }
/// <summary> /// Ctor. /// </summary> public DefaultSessionCoordinationService( IdentityServerOptions options, IPersistedGrantStore persistedGrantStore, IClientStore clientStore, IBackChannelLogoutService backChannelLogoutService, ILogger <DefaultSessionCoordinationService> logger, IServerSideSessionStore serverSideSessionStore = null) { Options = options; PersistedGrantStore = persistedGrantStore; ClientStore = clientStore; BackChannelLogoutService = backChannelLogoutService; Logger = logger; ServerSideSessionStore = serverSideSessionStore; }
public ServerSideSessionTests() { _urls.Origin = IdentityServerPipeline.BaseUrl; _urls.BasePath = "/"; _pipeline.OnPostConfigureServices += s => { s.AddSingleton <IServerUrls>(_urls); s.AddIdentityServerBuilder().AddServerSideSessions(); }; _pipeline.OnPostConfigure += app => { _pipeline.Options.ServerSideSessions.RemoveExpiredSessionsFrequency = TimeSpan.FromMilliseconds(100); app.Map("/user", ep => { ep.Run(ctx => { if (ctx.User.Identity.IsAuthenticated) { ctx.Response.StatusCode = 200; } else { ctx.Response.StatusCode = 401; } return(Task.CompletedTask); }); }); }; _pipeline.Users.Add(new TestUser { SubjectId = "bob", Username = "******", }); _pipeline.Users.Add(new TestUser { SubjectId = "alice", Username = "******", }); _pipeline.Clients.Add(new Client { ClientId = "client", AllowedGrantTypes = GrantTypes.Code, RequireClientSecret = false, RequireConsent = false, RequirePkce = false, AllowedScopes = { "openid", "api" }, AllowOfflineAccess = true, CoordinateLifetimeWithUserSession = true, RefreshTokenUsage = TokenUsage.ReUse, RedirectUris = { "https://client/callback" }, BackChannelLogoutUri = "https://client/bc-logout" }); _pipeline.IdentityScopes.Add(new IdentityResources.OpenId()); _pipeline.ApiScopes.Add(new ApiScope("api")); _pipeline.Initialize(); _sessionStore = _pipeline.Resolve <IServerSideSessionStore>(); _ticketService = _pipeline.Resolve <IServerSideTicketService>(); _sessionMgmt = _pipeline.Resolve <ISessionManagementService>(); _grantStore = _pipeline.Resolve <IPersistedGrantStore>(); _refreshTokenStore = _pipeline.Resolve <IRefreshTokenStore>(); }