mirror of
https://github.com/ferdzo/fs.git
synced 2026-04-05 01:56:25 +00:00
HOTFIX: Copy object and encoding fixed
This commit is contained in:
@@ -205,6 +205,29 @@ func (s *Service) AuthenticateRequest(r *http.Request) (RequestContext, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Service) Authorize(accessKeyID string, target RequestTarget) error {
|
||||
if !s.cfg.Enabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
accessKeyID = strings.TrimSpace(accessKeyID)
|
||||
if accessKeyID == "" {
|
||||
return ErrAccessDenied
|
||||
}
|
||||
if target.Action == "" {
|
||||
return ErrAccessDenied
|
||||
}
|
||||
|
||||
policy, err := s.store.GetAuthPolicy(accessKeyID)
|
||||
if err != nil {
|
||||
return ErrAccessDenied
|
||||
}
|
||||
if !isAllowed(policy, target) {
|
||||
return ErrAccessDenied
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Service) CreateUser(input CreateUserInput) (*CreateUserResult, error) {
|
||||
if !s.cfg.Enabled {
|
||||
return nil, ErrAuthNotEnabled
|
||||
|
||||
Reference in New Issue
Block a user