Skip to content

Commit 0e1d7d7

Browse files
committed
Add support for setting the domain of the cookie.
1 parent 671ebb8 commit 0e1d7d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ITfoxtec.Identity.Saml2.MvcCore/Configuration/Saml2ServiceCollectionExtensions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static class Saml2ServiceCollectionExtensions
1414
/// <param name="slidingExpiration">If set to true the handler re-issue a new cookie with a new expiration time any time it processes a request which is more than halfway through the expiration window.</param>
1515
/// <param name="accessDeniedPath">If configured, access denied redirection target used by the handler.</param>
1616
/// <param name="sessionStore">Allow configuration of a custom ITicketStore.</param>
17-
public static IServiceCollection AddSaml2(this IServiceCollection services, string loginPath = "/Auth/Login", bool slidingExpiration = false, string accessDeniedPath = null, ITicketStore sessionStore = null, SameSiteMode cookieSameSite = SameSiteMode.Lax)
17+
public static IServiceCollection AddSaml2(this IServiceCollection services, string loginPath = "/Auth/Login", bool slidingExpiration = false, string accessDeniedPath = null, ITicketStore sessionStore = null, SameSiteMode cookieSameSite = SameSiteMode.Lax, string cookieDomain = null)
1818
{
1919
services.AddAuthentication(Saml2Constants.AuthenticationScheme)
2020
.AddCookie(Saml2Constants.AuthenticationScheme, o =>
@@ -30,6 +30,10 @@ public static IServiceCollection AddSaml2(this IServiceCollection services, stri
3030
o.SessionStore = sessionStore;
3131
}
3232
o.Cookie.SameSite = cookieSameSite;
33+
if (!string.IsNullOrEmpty(cookieDomain))
34+
{
35+
o.Cookie.Domain = cookieDomain;
36+
}
3337
});
3438

3539
return services;

0 commit comments

Comments
 (0)