mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 08:19:23 +02:00
mcp: pass access token to the upstream (#5593)
This commit is contained in:
parent
b9e3a5d301
commit
5b024a8ada
15 changed files with 774 additions and 719 deletions
|
@ -1,7 +1,6 @@
|
|||
package mcp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -88,7 +87,7 @@ func (srv *Handler) handleAuthorizationCodeToken(w http.ResponseWriter, r *http.
|
|||
return
|
||||
}
|
||||
|
||||
accessToken, err := CreateAccessToken(session, srv.cipher)
|
||||
accessToken, err := srv.CreateAccessTokenForSession(session.Id, session.ExpiresAt.AsTime())
|
||||
if err != nil {
|
||||
http.Error(w, "internal error", http.StatusInternalServerError)
|
||||
return
|
||||
|
@ -117,12 +116,3 @@ 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