Skip to content
Open
Changes from 2 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
7 changes: 5 additions & 2 deletions admin/server/auth/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 thread
NamanMahor marked this conversation as resolved.
Outdated
Comment thread
NamanMahor marked this conversation as resolved.
Outdated
if err != nil {
http.Error(w, fmt.Sprintf("failed to issue API token: %s", err), http.StatusInternalServerError)
return
Expand Down Expand Up @@ -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
Expand Down
Loading