1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: sentry middleware interface conversion

This commit is contained in:
Ferdinand Mütsch
2023-01-02 10:55:57 +01:00
parent c1f1b05fa8
commit cf5a515952
3 changed files with 951 additions and 949 deletions

View File

@@ -146,15 +146,12 @@ func initSentry(config sentryConfig, debug bool) {
// returns a user id
func getPrincipal(r *http.Request) string {
type identifiable interface {
Identity() string
}
type principalGetter interface {
GetPrincipal() *identifiable
type principalIdentityGetter interface {
GetPrincipalIdentity() string
}
if p := r.Context().Value("principal"); p != nil {
return (*p.(principalGetter).GetPrincipal()).Identity()
return p.(principalIdentityGetter).GetPrincipalIdentity()
}
return ""
}