mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 00:40:25 +02:00
mcp: authorize: load session from the access token (#5591)
This commit is contained in:
parent
0602f5e00d
commit
daaf5b8e30
4 changed files with 112 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
package mcp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -116,3 +117,12 @@ func (srv *Handler) handleAuthorizationCodeToken(w http.ResponseWriter, r *http.
|
|||
w.WriteHeader(http.StatusOK)
|
||||
_, _ = w.Write(data)
|
||||
}
|
||||
|
||||
func (srv *Handler) GetSessionIDFromAccessToken(ctx context.Context, accessToken string) (string, bool) {
|
||||
sessionID, err := DecryptAccessToken(accessToken, srv.cipher)
|
||||
if err != nil {
|
||||
log.Ctx(ctx).Error().Err(err).Msg("failed to decrypt access token")
|
||||
return "", false
|
||||
}
|
||||
return sessionID, true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue