diff --git a/DigitalData.Auth.Claims/CookieNames.cs b/DigitalData.Auth.Claims/CookieNames.cs new file mode 100644 index 0000000..8efcdce --- /dev/null +++ b/DigitalData.Auth.Claims/CookieNames.cs @@ -0,0 +1,27 @@ +namespace DigitalData.Auth.Claims +{ + /// + /// Provides helpers for building cookie names used in the DigitalData.Auth ecosystem. + /// + public static class CookieNames + { + private const string ReceiverSuffix = "SignFLOWReceiver."; + + /// + /// Builds the cookie name for an envelope receiver token. + /// + /// The base cookie name configured in AuthApiParams. + /// The unique envelope receiver key. + /// A cookie name in the format {defaultCookieName}SignFLOWReceiver.{key}. + public static string GetEnvelopeReceiverCookieName(string defaultCookieName, string key) + => defaultCookieName + ReceiverSuffix + key; + + /// + /// Builds the cookie name for an envelope receiver token. This overload assumes a default cookie name of "AuthToken". + /// + /// The unique envelope receiver key. + /// A cookie name in the format {defaultCookieName}SignFLOWReceiver.{key}. + public static string GetEnvelopeReceiverCookieName(string key) + => "AuthToken" + ReceiverSuffix + key; + } +} diff --git a/src/DigitalData.Auth.API/Controllers/AuthController.cs b/src/DigitalData.Auth.API/Controllers/AuthController.cs index 94ecc85..bc898c0 100644 --- a/src/DigitalData.Auth.API/Controllers/AuthController.cs +++ b/src/DigitalData.Auth.API/Controllers/AuthController.cs @@ -2,6 +2,7 @@ using DigitalData.Auth.API.Entities; using DigitalData.Auth.API.Models; using DigitalData.Auth.API.Services.Contracts; +using DigitalData.Auth.Claims; using DigitalData.Core.Abstraction.Application; using DigitalData.Core.Abstraction.Application.DTO; using DigitalData.Core.Abstractions.Security.Extensions; @@ -258,7 +259,7 @@ namespace DigitalData.Auth.API.Controllers if (cookie) { var cookieOptions = consumer.CookieOptions ?? _apiParams.DefaultCookieOptions; - Response.Cookies.Append(_apiParams.DefaultCookieName, token, cookieOptions.Create(lifetime: descriptor.Lifetime)); + Response.Cookies.Append(CookieNames.GetEnvelopeReceiverCookieName(_apiParams.DefaultCookieName, key), token, cookieOptions.Create(lifetime: descriptor.Lifetime)); return Ok(); } else