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

Function AuthInfoFromPeer

credentials/alts/utils.go:46–52  ·  view source on GitHub ↗

AuthInfoFromPeer extracts the alts.AuthInfo object from the given peer, if it exists. This API should be used by gRPC clients after obtaining a peer object using the grpc.Peer() CallOption.

(p *peer.Peer)

Source from the content-addressed store, hash-verified

44// exists. This API should be used by gRPC clients after obtaining a peer object
45// using the grpc.Peer() CallOption.
46func AuthInfoFromPeer(p *peer.Peer) (AuthInfo, error) {
47 altsAuthInfo, ok := p.AuthInfo.(AuthInfo)
48 if !ok {
49 return nil, errors.New("no alts.AuthInfo found in Peer")
50 }
51 return altsAuthInfo, nil
52}
53
54// ClientAuthorizationCheck checks whether the client is authorized to access
55// the requested resources based on the given expected client service accounts.

Callers 3

TestAuthInfoFromPeerMethod · 0.85
AuthInfoFromContextFunction · 0.85

Calls

no outgoing calls