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

Function AuthInfoFromContext

credentials/alts/utils.go:35–41  ·  view source on GitHub ↗

AuthInfoFromContext extracts the alts.AuthInfo object from the given context, if it exists. This API should be used by gRPC server RPC handlers to get information about the communicating peer. For client-side, use grpc.Peer() CallOption.

(ctx context.Context)

Source from the content-addressed store, hash-verified

33// information about the communicating peer. For client-side, use grpc.Peer()
34// CallOption.
35func AuthInfoFromContext(ctx context.Context) (AuthInfo, error) {
36 p, ok := peer.FromContext(ctx)
37 if !ok {
38 return nil, errors.New("no Peer found in Context")
39 }
40 return AuthInfoFromPeer(p)
41}
42
43// AuthInfoFromPeer extracts the alts.AuthInfo object from the given peer, if it
44// exists. This API should be used by gRPC clients after obtaining a peer object

Callers 3

authzFunction · 0.92
ClientAuthorizationCheckFunction · 0.85

Calls 2

FromContextFunction · 0.92
AuthInfoFromPeerFunction · 0.85

Tested by 1