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)
| 44 | // exists. This API should be used by gRPC clients after obtaining a peer object |
| 45 | // using the grpc.Peer() CallOption. |
| 46 | func 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. |
no outgoing calls