mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
OIDC: Ensure ID tokens fit into the auth_sessions.id_token column #5294
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
d89ac51159
commit
6e82481944
1 changed files with 8 additions and 1 deletions
|
|
@ -339,7 +339,14 @@ func OIDCRedirect(router *gin.RouterGroup) {
|
|||
sess.SetAuthID(user.AuthID, provider.Issuer())
|
||||
sess.SetUser(user)
|
||||
sess.SetGrantType(authn.GrantAuthorizationCode)
|
||||
sess.IdToken = tokens.IDToken
|
||||
|
||||
// Ensure that the ID token fits into the existing
|
||||
// database column; otherwise, truncate it.
|
||||
if n := len(tokens.IDToken); n > 2048 {
|
||||
sess.IdToken = tokens.IDToken[:2048]
|
||||
} else {
|
||||
sess.IdToken = tokens.IDToken
|
||||
}
|
||||
|
||||
// Set session expiration and timeout.
|
||||
sess.SetExpiresIn(unix.Day)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue