CredentialsFromContext returns the Credentials used by ctx, or a set of Credentials with no capabilities if ctx does not have Credentials.
(ctx context.Context)
| 33 | // CredentialsFromContext returns the Credentials used by ctx, or a |
| 34 | // set of Credentials with no capabilities if ctx does not have Credentials. |
| 35 | func CredentialsFromContext(ctx context.Context) *Credentials { |
| 36 | if v := ctx.Value(CtxCredentials); v != nil { |
| 37 | return v.(*Credentials) |
| 38 | } |
| 39 | return NewAnonymousCredentials() |
| 40 | } |
| 41 | |
| 42 | // CredentialsOrNilFromContext returns a copy of the Credentials used by ctx, |
| 43 | // or nil if ctx does not have Credentials. |
searching dependent graphs…