Skip to content
Merged
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
8 changes: 5 additions & 3 deletions src/SilkierQuartz/Configuration/ServiceCollectionExtensions.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ public static IServiceCollection AddSilkierQuartz(
services.AddSingleton(authenticationOptions);
if (authenticationOptions.AccessRequirement != SilkierQuartzAuthenticationOptions.SimpleAccessRequirement.AllowAnonymous)
{
var normalizedVirtualPath = $"{options.VirtualPathRoot}{(options.VirtualPathRoot.EndsWith('/') ? "" : "/")}";
var cookiePath = $"{options.BasePath}{(options.BasePath.EndsWith('/') ? "" : "/")}{normalizedVirtualPath.Trim('/')}";
services
.AddAuthentication(authenticationOptions.AuthScheme)
.AddCookie(authenticationOptions.AuthScheme, cfg =>
{
cfg.Cookie.Name = authenticationOptions.CookieName;
cfg.Cookie.Path = options.VirtualPathRoot;
cfg.LoginPath = $"{options.VirtualPathRoot}{(options.VirtualPathRoot.EndsWith('/') ? "" : "/")}Authenticate/Login";
cfg.AccessDeniedPath = $"{options.VirtualPathRoot}{(options.VirtualPathRoot.EndsWith('/') ? "" : "/")}Authenticate/Login";
cfg.Cookie.Path = cookiePath;
cfg.LoginPath = $"{normalizedVirtualPath}Authenticate/Login";
cfg.AccessDeniedPath = $"{normalizedVirtualPath}Authenticate/Login";
Comment on lines +42 to +44
Copy link
Copy Markdown
Contributor Author

@AT-WH AT-WH Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cookie path needs to be BasePath + QuatrzVirtualPath. Otherwise it doesn't grant access to the app.

cfg.ExpireTimeSpan = TimeSpan.FromDays(7);
cfg.SlidingExpiration = true;
});
Expand Down
Loading