moved middleware auth to auth package
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
etsy_platform "ruben/inventory2/internal/domains/platforms/etsy"
|
||||
"ruben/inventory2/internal/domains/raw_events"
|
||||
"ruben/inventory2/internal/logging"
|
||||
"ruben/inventory2/internal/server/middleware"
|
||||
"ruben/inventory2/internal/server/auth"
|
||||
"ruben/inventory2/internal/server/response"
|
||||
|
||||
"github.com/angelbeltran/templater"
|
||||
@@ -124,7 +124,7 @@ func (s *webpageRouter) serveTemplate(c *gin.Context) (response.Response, error)
|
||||
|
||||
// auth tooling
|
||||
"Identity",
|
||||
middleware.GetIdentity(ctx),
|
||||
auth.GetIdentity(ctx),
|
||||
"Auth",
|
||||
newTemplateAuthenticator(r),
|
||||
}
|
||||
@@ -218,7 +218,7 @@ func authorizeByMatchingAccountID(r *http.Request, acctIDPathPosition int) error
|
||||
Msgf("account does not exist: %s", part)
|
||||
}
|
||||
|
||||
id := middleware.GetIdentity(r.Context())
|
||||
id := auth.GetIdentity(r.Context())
|
||||
if id.Account == nil || id.Account.AccountID != acctID {
|
||||
return response.Unauthorized().
|
||||
Msgf("user does not have access to account %d", acctID)
|
||||
|
||||
Reference in New Issue
Block a user