outposts: check if hub from context is set and fallback
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
f8aab40e3e
commit
7d6e88061f
|
@ -26,7 +26,11 @@ func NewRequest(bindDN string, bindPW string, conn net.Conn) (*Request, *sentry.
|
||||||
span.Description = bindDN
|
span.Description = bindDN
|
||||||
rid := uuid.New().String()
|
rid := uuid.New().String()
|
||||||
span.SetTag("request_uid", rid)
|
span.SetTag("request_uid", rid)
|
||||||
sentry.GetHubFromContext(span.Context()).Scope().SetUser(sentry.User{
|
hub := sentry.GetHubFromContext(span.Context())
|
||||||
|
if hub == nil {
|
||||||
|
hub = sentry.CurrentHub()
|
||||||
|
}
|
||||||
|
hub.Scope().SetUser(sentry.User{
|
||||||
Username: bindDN,
|
Username: bindDN,
|
||||||
ID: bindDN,
|
ID: bindDN,
|
||||||
IPAddress: utils.GetIP(conn.RemoteAddr()),
|
IPAddress: utils.GetIP(conn.RemoteAddr()),
|
||||||
|
|
|
@ -30,7 +30,11 @@ func NewRequest(bindDN string, searchReq ldap.SearchRequest, conn net.Conn) (*Re
|
||||||
span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.search", sentry.TransactionName("authentik.providers.ldap.search"))
|
span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.search", sentry.TransactionName("authentik.providers.ldap.search"))
|
||||||
span.Description = fmt.Sprintf("%s (%s)", searchReq.BaseDN, ldap.ScopeMap[searchReq.Scope])
|
span.Description = fmt.Sprintf("%s (%s)", searchReq.BaseDN, ldap.ScopeMap[searchReq.Scope])
|
||||||
span.SetTag("request_uid", rid)
|
span.SetTag("request_uid", rid)
|
||||||
sentry.GetHubFromContext(span.Context()).Scope().SetUser(sentry.User{
|
hub := sentry.GetHubFromContext(span.Context())
|
||||||
|
if hub == nil {
|
||||||
|
hub = sentry.CurrentHub()
|
||||||
|
}
|
||||||
|
hub.Scope().SetUser(sentry.User{
|
||||||
Username: bindDN,
|
Username: bindDN,
|
||||||
ID: bindDN,
|
ID: bindDN,
|
||||||
IPAddress: utils.GetIP(conn.RemoteAddr()),
|
IPAddress: utils.GetIP(conn.RemoteAddr()),
|
||||||
|
|
|
@ -111,7 +111,11 @@ func NewApplication(p api.ProxyOutpostConfig, c *http.Client, cs *ak.CryptoStore
|
||||||
user := ""
|
user := ""
|
||||||
if c != nil {
|
if c != nil {
|
||||||
user = c.PreferredUsername
|
user = c.PreferredUsername
|
||||||
sentry.GetHubFromContext(r.Context()).Scope().SetUser(sentry.User{
|
hub := sentry.GetHubFromContext(r.Context())
|
||||||
|
if hub == nil {
|
||||||
|
hub = sentry.CurrentHub()
|
||||||
|
}
|
||||||
|
hub.Scope().SetUser(sentry.User{
|
||||||
Username: user,
|
Username: user,
|
||||||
ID: c.Sub,
|
ID: c.Sub,
|
||||||
IPAddress: r.RemoteAddr,
|
IPAddress: r.RemoteAddr,
|
||||||
|
|
Reference in New Issue