Skip to content

Commit

Permalink
feat: option to update session cookie expiry time on session refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
aarmam committed Nov 24, 2021
1 parent 31af257 commit 219d381
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion consent/strategy_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func (s *DefaultStrategy) verifyAuthentication(w http.ResponseWriter, r *http.Re
}
}

if !session.Remember || session.LoginRequest.Skip {
if !session.Remember || session.LoginRequest.Skip && !session.RefreshRememberFor {
// If the user doesn't want to remember the session, we do not store a cookie.
// If login was skipped, it means an authentication cookie was present and
// we don't want to touch it (in order to preserve its original expiry date)
Expand Down
3 changes: 3 additions & 0 deletions consent/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ type HandledLoginRequest struct {
// authorization will be remembered for the duration of the browser session (using a session cookie).
RememberFor int `json:"remember_for" db:"remember_for"`

// RefreshRememberFor, if set to true, session cookie expiry time will be reset when session is refreshed.
RefreshRememberFor bool `json:"refresh_remember_for" db:"refresh_remember_for"`

// ACR sets the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it
// to express that, for example, a user authenticated using two factor authentication.
ACR string `json:"acr" db:"acr"`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN refresh_remember_for;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled ADD refresh_remember_for BOOLEAN NOT NULL DEFAULT FALSE;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN refresh_remember_for;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled ADD COLUMN refresh_remember_for BOOLEAN NOT NULL DEFAULT FALSE;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN refresh_remember_for;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled ADD refresh_remember_for BOOLEAN NOT NULL DEFAULT FALSE;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled DROP COLUMN refresh_remember_for;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE hydra_oauth2_authentication_request_handled ADD refresh_remember_for BOOLEAN NOT NULL DEFAULT FALSE;

0 comments on commit 219d381

Please sign in to comment.