SPIFFEIDFromState parses the SPIFFE ID from State. If the SPIFFE ID format is invalid, return nil with warning.
(state tls.ConnectionState)
| 34 | // SPIFFEIDFromState parses the SPIFFE ID from State. If the SPIFFE ID format |
| 35 | // is invalid, return nil with warning. |
| 36 | func SPIFFEIDFromState(state tls.ConnectionState) *url.URL { |
| 37 | if len(state.PeerCertificates) == 0 || len(state.PeerCertificates[0].URIs) == 0 { |
| 38 | return nil |
| 39 | } |
| 40 | return SPIFFEIDFromCert(state.PeerCertificates[0]) |
| 41 | } |
| 42 | |
| 43 | // SPIFFEIDFromCert parses the SPIFFE ID from x509.Certificate. If the SPIFFE |
| 44 | // ID format is invalid, return nil with warning. |