[#283] Support frostfsid groups in policy request checking

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-12-13 17:44:18 +03:00
parent 43cae9ee04
commit 5698d5844e
11 changed files with 92 additions and 56 deletions

View file

@ -71,11 +71,11 @@ func Auth(center Center, log *zap.Logger) Func {
}
}
type FrostFSID interface {
type FrostFSIDValidator interface {
ValidatePublicKey(key *keys.PublicKey) error
}
func FrostfsIDValidation(frostfsID FrostFSID, log *zap.Logger) Func {
func FrostfsIDValidation(frostfsID FrostFSIDValidator, log *zap.Logger) Func {
return func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@ -97,7 +97,7 @@ func FrostfsIDValidation(frostfsID FrostFSID, log *zap.Logger) Func {
}
}
func validateBearerToken(frostfsID FrostFSID, bt *bearer.Token) error {
func validateBearerToken(frostfsID FrostFSIDValidator, bt *bearer.Token) error {
m := new(acl.BearerToken)
bt.WriteToV2(m)