MCPcopy
hub / github.com/grpc/grpc-go / NewStatic

Function NewStatic

authz/grpc_authz_server_interceptors.go:46–56  ·  view source on GitHub ↗

NewStatic returns a new StaticInterceptor from a static authorization policy JSON string.

(authzPolicy string)

Source from the content-addressed store, hash-verified

44// NewStatic returns a new StaticInterceptor from a static authorization policy
45// JSON string.
46func NewStatic(authzPolicy string) (*StaticInterceptor, error) {
47 rbacs, policyName, err := translatePolicy(authzPolicy)
48 if err != nil {
49 return nil, err
50 }
51 chainEngine, err := rbac.NewChainEngine(rbacs, policyName)
52 if err != nil {
53 return nil, err
54 }
55 return &StaticInterceptor{*chainEngine}, nil
56}
57
58// UnaryInterceptor intercepts incoming Unary RPC requests.
59// Only authorized requests are allowed to pass. Otherwise, an unauthorized

Calls 2

NewChainEngineFunction · 0.92
translatePolicyFunction · 0.85