-
Notifications
You must be signed in to change notification settings - Fork 171
updating ttl to 14days #9446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
updating ttl to 14days #9446
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ const ( | |
| cookieFieldRedirect = "redirect" | ||
| cookieFieldCustomDomainFlow = "custom_domain_flow" | ||
| cookieFieldAccessToken = "access_token" | ||
| browserSessionTTL = 14 * 24 * time.Hour | ||
| ) | ||
|
|
||
| // RegisterEndpoints adds HTTP endpoints for auth. | ||
|
|
@@ -342,7 +343,8 @@ func (a *Authenticator) authLoginCallback(w http.ResponseWriter, r *http.Request | |
| } | ||
|
|
||
| // Issue a new persistent auth token | ||
| authToken, err := a.admin.IssueUserAuthToken(r.Context(), user.ID, database.AuthClientIDRillWeb, "Browser session", nil, nil, false) | ||
| ttl := browserSessionTTL | ||
| authToken, err := a.admin.IssueUserAuthToken(r.Context(), user.ID, database.AuthClientIDRillWeb, "Browser session", nil, &ttl, false) | ||
|
Comment on lines
+346
to
+347
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it also needs to integrate with (Also, since updating the TTL in the DB is more expensive than updating the cookie, it would need to not do this too often, e.g. only when close to expiration.). Or do you have a better idea? |
||
| if err != nil { | ||
| http.Error(w, fmt.Sprintf("failed to issue API token: %s", err), http.StatusInternalServerError) | ||
| return | ||
|
|
@@ -405,7 +407,8 @@ func (a *Authenticator) authLoginCustomDomainCallback(w http.ResponseWriter, r * | |
| http.Error(w, err.Error(), http.StatusUnauthorized) | ||
| return | ||
| } | ||
| newAuthToken, err := a.admin.IssueUserAuthToken(r.Context(), validated.OwnerID(), database.AuthClientIDRillWeb, "Browser session", nil, nil, false) | ||
| ttl := browserSessionTTL | ||
| newAuthToken, err := a.admin.IssueUserAuthToken(r.Context(), validated.OwnerID(), database.AuthClientIDRillWeb, "Browser session", nil, &ttl, false) | ||
| if err != nil { | ||
| http.Error(w, fmt.Sprintf("failed to issue API token: %s", err), http.StatusInternalServerError) | ||
| return | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: redundant variable, can just do
&browserSessionTTLdirectly