mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-20 08:04:52 +00:00
Some checks failed
Post / coverage (push) Failing after 28s
Post / images (amd64, addon-manager) (push) Failing after 22s
Post / images (amd64, placement) (push) Failing after 31s
Post / images (amd64, registration) (push) Failing after 27s
Post / images (amd64, registration-operator) (push) Failing after 30s
Post / images (amd64, work) (push) Failing after 31s
Post / images (arm64, addon-manager) (push) Failing after 35s
Post / images (arm64, placement) (push) Failing after 27s
Post / images (arm64, registration) (push) Failing after 21s
Post / images (arm64, registration-operator) (push) Failing after 33s
Post / images (arm64, work) (push) Failing after 31s
Post / image manifest (addon-manager) (push) Has been skipped
Post / image manifest (placement) (push) Has been skipped
Post / image manifest (registration) (push) Has been skipped
Post / image manifest (registration-operator) (push) Has been skipped
Post / image manifest (work) (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Scorecard supply-chain security / Scorecard analysis (push) Failing after 47s
Close stale issues and PRs / stale (push) Successful in 47s
Signed-off-by: morvencao <lcao@redhat.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
28 lines
739 B
Go
28 lines
739 B
Go
package util
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"open-cluster-management.io/sdk-go/pkg/server/grpc/authz"
|
|
)
|
|
|
|
type MockAuthorizer struct{}
|
|
|
|
// validate MockAuthorizer implement StreamAuthorizer and UnaryAuthorizer
|
|
var _ authz.StreamAuthorizer = (*MockAuthorizer)(nil)
|
|
var _ authz.UnaryAuthorizer = (*MockAuthorizer)(nil)
|
|
|
|
func NewMockAuthorizer() *MockAuthorizer {
|
|
return &MockAuthorizer{}
|
|
}
|
|
|
|
func (s *MockAuthorizer) AuthorizeRequest(ctx context.Context, req any) (authz.Decision, error) {
|
|
return authz.DecisionAllow, nil
|
|
}
|
|
|
|
func (s *MockAuthorizer) AuthorizeStream(ctx context.Context, ss grpc.ServerStream, info *grpc.StreamServerInfo) (authz.Decision, grpc.ServerStream, error) {
|
|
return authz.DecisionAllow, ss, nil
|
|
}
|