mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 10:56:28 +02:00
only check impersonate id on non-nil pbSession
This commit is contained in:
parent
b6c1068de7
commit
a6f7ca5abd
1 changed files with 9 additions and 4 deletions
|
@ -453,15 +453,20 @@ func (a *Authenticate) userInfo(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
|
||||||
isImpersonated := false
|
isImpersonated := false
|
||||||
pbSession, err := session.Get(ctx, state.dataBrokerClient, s.ID)
|
pbSession, err := session.Get(ctx, state.dataBrokerClient, s.ID)
|
||||||
if pbSession.GetImpersonateSessionId() != "" {
|
|
||||||
pbSession, err = session.Get(ctx, state.dataBrokerClient, pbSession.GetImpersonateSessionId())
|
|
||||||
isImpersonated = true
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pbSession = &session.Session{
|
pbSession = &session.Session{
|
||||||
Id: s.ID,
|
Id: s.ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if pbSession.GetImpersonateSessionId() != "" {
|
||||||
|
pbSession, err = session.Get(ctx, state.dataBrokerClient, pbSession.GetImpersonateSessionId())
|
||||||
|
isImpersonated = true
|
||||||
|
if err != nil {
|
||||||
|
pbSession = &session.Session{
|
||||||
|
Id: s.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pbUser, err := user.Get(ctx, state.dataBrokerClient, pbSession.GetUserId())
|
pbUser, err := user.Get(ctx, state.dataBrokerClient, pbSession.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue