Functions for constructing CEL inputs. auth constructs a `google.rpc.context.AttributeContext.Auth` message.
(user string, claims map[string]string)
| 250 | |
| 251 | // auth constructs a `google.rpc.context.AttributeContext.Auth` message. |
| 252 | func auth(user string, claims map[string]string) *rpcpb.AttributeContext_Auth { |
| 253 | claimFields := make(map[string]*structpb.Value) |
| 254 | for k, v := range claims { |
| 255 | claimFields[k] = structpb.NewStringValue(v) |
| 256 | } |
| 257 | return &rpcpb.AttributeContext_Auth{ |
| 258 | Principal: user, |
| 259 | Claims: &structpb.Struct{Fields: claimFields}, |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | // request constructs a `google.rpc.context.AttributeContext.Request` message. |
| 264 | func request(auth *rpcpb.AttributeContext_Auth, t time.Time) map[string]any { |
nothing calls this directly
no outgoing calls
no test coverage detected