authorizer func: pass through context
Signed-off-by: Monis Khan <mok@vmware.com> Kubernetes-commit: 8f00e918d84a76ea43d76a8d5b96c3f2535afa99
This commit is contained in:
parent
db0339edde
commit
e14444ffc5
|
@ -71,10 +71,10 @@ type Authorizer interface {
|
||||||
Authorize(ctx context.Context, a Attributes) (authorized Decision, reason string, err error)
|
Authorize(ctx context.Context, a Attributes) (authorized Decision, reason string, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthorizerFunc func(a Attributes) (Decision, string, error)
|
type AuthorizerFunc func(ctx context.Context, a Attributes) (Decision, string, error)
|
||||||
|
|
||||||
func (f AuthorizerFunc) Authorize(ctx context.Context, a Attributes) (Decision, string, error) {
|
func (f AuthorizerFunc) Authorize(ctx context.Context, a Attributes) (Decision, string, error) {
|
||||||
return f(a)
|
return f(ctx, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RuleResolver provides a mechanism for resolving the list of rules that apply to a given user within a namespace.
|
// RuleResolver provides a mechanism for resolving the list of rules that apply to a given user within a namespace.
|
||||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
package path
|
package path
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ func NewAuthorizer(alwaysAllowPaths []string) (authorizer.Authorizer, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return authorizer.AuthorizerFunc(func(a authorizer.Attributes) (authorizer.Decision, string, error) {
|
return authorizer.AuthorizerFunc(func(ctx context.Context, a authorizer.Attributes) (authorizer.Decision, string, error) {
|
||||||
if a.IsResourceRequest() {
|
if a.IsResourceRequest() {
|
||||||
return authorizer.DecisionNoOpinion, "", nil
|
return authorizer.DecisionNoOpinion, "", nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue