@@ -64,13 +64,8 @@ func (api *API) Authorize(r *http.Request, action rbac.Action, object rbac.Objec
64
64
// return
65
65
// }
66
66
func (h * HTTPAuthorizer ) Authorize (r * http.Request , action rbac.Action , object rbac.Objecter ) bool {
67
- authz , ok := httpmw .Actor (r )
68
- if ! ok {
69
- // No authorization object.
70
- return false
71
- }
72
-
73
- err := h .Authorizer .Authorize (r .Context (), authz .Actor , action , object .RBACObject ())
67
+ roles := httpmw .UserAuthorization (r )
68
+ err := h .Authorizer .Authorize (r .Context (), roles .Actor , action , object .RBACObject ())
74
69
if err != nil {
75
70
// Log the errors for debugging
76
71
internalError := new (rbac.UnauthorizedError )
@@ -81,10 +76,10 @@ func (h *HTTPAuthorizer) Authorize(r *http.Request, action rbac.Action, object r
81
76
// Log information for debugging. This will be very helpful
82
77
// in the early days
83
78
logger .Warn (r .Context (), "unauthorized" ,
84
- slog .F ("roles" , authz .Actor .SafeRoleNames ()),
85
- slog .F ("actor_id" , authz .Actor .ID ),
86
- slog .F ("actor_name" , authz .ActorName ),
87
- slog .F ("scope" , authz .Actor .SafeScopeName ()),
79
+ slog .F ("roles" , roles .Actor .SafeRoleNames ()),
80
+ slog .F ("actor_id" , roles .Actor .ID ),
81
+ slog .F ("actor_name" , roles .ActorName ),
82
+ slog .F ("scope" , roles .Actor .SafeScopeName ()),
88
83
slog .F ("route" , r .URL .Path ),
89
84
slog .F ("action" , action ),
90
85
slog .F ("object" , object ),
0 commit comments