Check if token still exist for trust center access
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -205,7 +205,7 @@ func tryTokenAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, t
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
payload, err := statelesstoken.ValidateToken[probo.TrustCenterAccessData](
|
basicPayload, err := statelesstoken.ValidateToken[probo.TrustCenterAccessData](
|
||||||
trustAuthCfg.TokenSecret,
|
trustAuthCfg.TokenSecret,
|
||||||
trustAuthCfg.TokenType,
|
trustAuthCfg.TokenType,
|
||||||
cookie.Value,
|
cookie.Value,
|
||||||
@@ -215,11 +215,18 @@ func tryTokenAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, t
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
tenantID := payload.Data.TrustCenterID.TenantID()
|
tenantID := basicPayload.Data.TrustCenterID.TenantID()
|
||||||
|
|
||||||
|
tenantSvc := trustSvc.WithTenant(tenantID)
|
||||||
|
payload, err := tenantSvc.TrustCenterAccesses.ValidateToken(ctx, cookie.Value)
|
||||||
|
if err != nil {
|
||||||
|
clearTokenCookie(w, trustAuthCfg)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
tokenAccess := &auth.TokenAccessData{
|
tokenAccess := &auth.TokenAccessData{
|
||||||
TrustCenterID: payload.Data.TrustCenterID,
|
TrustCenterID: payload.TrustCenterID,
|
||||||
Email: payload.Data.Email,
|
Email: payload.Email,
|
||||||
TenantID: tenantID,
|
TenantID: tenantID,
|
||||||
Scope: trustAuthCfg.Scope,
|
Scope: trustAuthCfg.Scope,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user