![dependabot[bot]](/assets/img/avatar_default.png) 4d58eba027
			
		
	
	4d58eba027
	
	
	
		
			
			* core: bump github.com/getsentry/sentry-go from 0.20.0 to 0.21.0 Bumps [github.com/getsentry/sentry-go](https://github.com/getsentry/sentry-go) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/getsentry/sentry-go/releases) - [Changelog](https://github.com/getsentry/sentry-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-go/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: github.com/getsentry/sentry-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package bind
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"net"
 | |
| 	"strings"
 | |
| 
 | |
| 	"github.com/getsentry/sentry-go"
 | |
| 	"github.com/google/uuid"
 | |
| 	log "github.com/sirupsen/logrus"
 | |
| 	"goauthentik.io/internal/utils"
 | |
| )
 | |
| 
 | |
| type Request struct {
 | |
| 	BindDN string
 | |
| 	BindPW string
 | |
| 	id     string
 | |
| 	conn   net.Conn
 | |
| 	log    *log.Entry
 | |
| 	ctx    context.Context
 | |
| }
 | |
| 
 | |
| func NewRequest(bindDN string, bindPW string, conn net.Conn) (*Request, *sentry.Span) {
 | |
| 	span := sentry.StartSpan(context.TODO(), "authentik.providers.ldap.bind",
 | |
| 		sentry.WithTransactionName("authentik.providers.ldap.bind"))
 | |
| 	span.Description = bindDN
 | |
| 	rid := uuid.New().String()
 | |
| 	span.SetTag("request_uid", rid)
 | |
| 	hub := sentry.GetHubFromContext(span.Context())
 | |
| 	if hub == nil {
 | |
| 		hub = sentry.CurrentHub()
 | |
| 	}
 | |
| 	hub.Scope().SetUser(sentry.User{
 | |
| 		Username:  bindDN,
 | |
| 		ID:        bindDN,
 | |
| 		IPAddress: utils.GetIP(conn.RemoteAddr()),
 | |
| 	})
 | |
| 
 | |
| 	bindDN = strings.ToLower(bindDN)
 | |
| 	return &Request{
 | |
| 		BindDN: bindDN,
 | |
| 		BindPW: bindPW,
 | |
| 		conn:   conn,
 | |
| 		log:    log.WithField("bindDN", bindDN).WithField("requestId", rid).WithField("client", utils.GetIP(conn.RemoteAddr())),
 | |
| 		id:     rid,
 | |
| 		ctx:    span.Context(),
 | |
| 	}, span
 | |
| }
 | |
| 
 | |
| func (r *Request) Context() context.Context {
 | |
| 	return r.ctx
 | |
| }
 | |
| 
 | |
| func (r *Request) Log() *log.Entry {
 | |
| 	return r.log
 | |
| }
 | |
| 
 | |
| func (r *Request) RemoteAddr() string {
 | |
| 	return utils.GetIP(r.conn.RemoteAddr())
 | |
| }
 | |
| 
 | |
| func (r *Request) ID() string {
 | |
| 	return r.id
 | |
| }
 |