Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,25 @@ or Claims.Private.RegistrationId or Claims.Private.ProviderName
OpenIddictClientOwinConstants.Tokens.BackchannelAccessToken or
OpenIddictClientOwinConstants.Tokens.BackchannelIdentityToken or
OpenIddictClientOwinConstants.Tokens.RefreshToken)
.ToDictionary(pair => pair.Key, pair => pair.Value));
.ToDictionary(pair => pair.Key, pair => pair.Value))
{
// Set the creation and expiration dates of the ticket to null to decorrelate the lifetime
// of the resulting authentication cookie from the lifetime of the identity token returned by
// the authorization server (if applicable). In this case, the expiration date time will be
// automatically computed by the cookie handler using the lifetime configured in the options.
//
// Applications that prefer binding the lifetime of the ticket stored in the authentication cookie
// to the identity token returned by the identity provider can remove or comment these two lines:
IssuedUtc = null,
ExpiresUtc = null,

// Note: this flag controls whether the authentication cookie that will be returned to the
// browser will be treated as a session cookie (i.e destroyed when the browser is closed)
// or as a persistent cookie. In both cases, the lifetime of the authentication ticket is
// always stored as protected data, preventing malicious users from trying to use an
// authentication cookie beyond the lifetime of the authentication ticket itself.
IsPersistent = false
};

context.Authentication.SignIn(properties, identity);
return Redirect(properties.RedirectUri ?? "/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,25 @@ or Claims.Private.RegistrationId or Claims.Private.ProviderName
// If needed, the tokens returned by the authorization server can be stored in the authentication cookie.
OpenIddictClientOwinConstants.Tokens.BackchannelAccessToken or
OpenIddictClientOwinConstants.Tokens.RefreshToken)
.ToDictionary(pair => pair.Key, pair => pair.Value));
.ToDictionary(pair => pair.Key, pair => pair.Value))
{
// Set the creation and expiration dates of the ticket to null to decorrelate the lifetime
// of the resulting authentication cookie from the lifetime of the identity token returned by
// the authorization server (if applicable). In this case, the expiration date time will be
// automatically computed by the cookie handler using the lifetime configured in the options.
//
// Applications that prefer binding the lifetime of the ticket stored in the authentication cookie
// to the identity token returned by the identity provider can remove or comment these two lines:
IssuedUtc = null,
ExpiresUtc = null,

// Note: this flag controls whether the authentication cookie that will be returned to the
// browser will be treated as a session cookie (i.e destroyed when the browser is closed)
// or as a persistent cookie. In both cases, the lifetime of the authentication ticket is
// always stored as protected data, preventing malicious users from trying to use an
// authentication cookie beyond the lifetime of the authentication ticket itself.
IsPersistent = false
};

context.Authentication.SignIn(properties, identity);
return Redirect(properties.RedirectUri ?? "/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,24 @@ public async Task<ActionResult> LogInCallback()
// Build the authentication properties based on the properties that were added when the challenge was triggered.
var properties = new AuthenticationProperties(result.Properties.Items)
{
RedirectUri = result.Properties.RedirectUri ?? "/"
RedirectUri = result.Properties.RedirectUri ?? "/",

// Set the creation and expiration dates of the ticket to null to decorrelate the lifetime
// of the resulting authentication cookie from the lifetime of the identity token returned by
// the authorization server (if applicable). In this case, the expiration date time will be
// automatically computed by the cookie handler using the lifetime configured in the options.
//
// Applications that prefer binding the lifetime of the ticket stored in the authentication cookie
// to the identity token returned by the identity provider can remove or comment these two lines:
IssuedUtc = null,
ExpiresUtc = null,

// Note: this flag controls whether the authentication cookie that will be returned to the
// browser will be treated as a session cookie (i.e destroyed when the browser is closed)
// or as a persistent cookie. In both cases, the lifetime of the authentication ticket is
// always stored as protected data, preventing malicious users from trying to use an
// authentication cookie beyond the lifetime of the authentication ticket itself.
IsPersistent = false
};

// If needed, the tokens returned by the authorization server can be stored in the authentication cookie.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,24 @@ public async Task<ActionResult> LogInCallback()
// Build the authentication properties based on the properties that were added when the challenge was triggered.
var properties = new AuthenticationProperties(result.Properties.Items)
{
RedirectUri = result.Properties.RedirectUri ?? "/"
RedirectUri = result.Properties.RedirectUri ?? "/",

// Set the creation and expiration dates of the ticket to null to decorrelate the lifetime
// of the resulting authentication cookie from the lifetime of the identity token returned by
// the authorization server (if applicable). In this case, the expiration date time will be
// automatically computed by the cookie handler using the lifetime configured in the options.
//
// Applications that prefer binding the lifetime of the ticket stored in the authentication cookie
// to the identity token returned by the identity provider can remove or comment these two lines:
IssuedUtc = null,
ExpiresUtc = null,

// Note: this flag controls whether the authentication cookie that will be returned to the
// browser will be treated as a session cookie (i.e destroyed when the browser is closed)
// or as a persistent cookie. In both cases, the lifetime of the authentication ticket is
// always stored as protected data, preventing malicious users from trying to use an
// authentication cookie beyond the lifetime of the authentication ticket itself.
IsPersistent = false
};

// If needed, the tokens returned by the authorization server can be stored in the authentication cookie.
Expand Down