Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is a SPIFFE ID
func FromString ¶
FromString parses a SPIFFE ID from a string.
func Must ¶
Must creates a new ID using the trust domain (e.g. example.org) and path segments. The function panics if the trust domain is not valid (see TrustDomainFromString).
func New ¶
New creates a new ID using the trust domain (e.g. example.org) and path segments. The resulting path after joining the segments is normalized according to the rules of the standard path.Join() function. An error is returned if the trust domain is not valid (see TrustDomainFromString).
func RequireFromString ¶
RequireFromString is similar to FromString except that instead of returning an error on malformed input, it panics. It should only be used when given string is statically verifiable.
func RequireFromURI ¶
RequireFromURI is similar to FromURI except that instead of returning an error on malformed input, it panics. It should only be used when given string is statically verifiable.
func (ID) MemberOf ¶
func (id ID) MemberOf(td TrustDomain) bool
MemberOf returns true if the SPIFFE ID is a member of the given trust domain.
func (ID) String ¶
String returns the string representation of the SPIFFE ID, e.g., "spiffe://example.org/foo/bar".
func (ID) TrustDomain ¶
func (id ID) TrustDomain() TrustDomain
TrustDomain returns the trust domain of the SPIFFE ID.
type Matcher ¶
Matcher is used to match a SPIFFE ID.
func MatchMemberOf ¶
func MatchMemberOf(expected TrustDomain) Matcher
MatchMemberOf matches any SPIFFE ID in the given trust domain.
func MatchOneOf ¶
MatchOneOf matches any SPIFFE ID in the given list of IDs.
type TrustDomain ¶
type TrustDomain struct {
// contains filtered or unexported fields
}
TrustDomain is the name of a SPIFFE trust domain (e.g. example.org).
func RequireTrustDomainFromString ¶
func RequireTrustDomainFromString(s string) TrustDomain
RequireTrustDomainFromString is similar to TrustDomainFromString except that instead of returning an error on malformed input, it panics. It should only be used when given string is statically verifiable.
func RequireTrustDomainFromURI ¶
func RequireTrustDomainFromURI(uri *url.URL) TrustDomain
RequireTrustDomainFromURI is similar to TrustDomainFromURI except that instead of returning an error on malformed input, it panics. It should only be used when the given URI is statically verifiable.
func TrustDomainFromString ¶
func TrustDomainFromString(s string) (TrustDomain, error)
TrustDomainFromString returns a new TrustDomain from a string. The string can either be the host part of a URI authority component (e.g. example.org), or a valid SPIFFE ID URI (e.g. spiffe://example.org), otherwise an error is returned. The trust domain is normalized to lower case.
func TrustDomainFromURI ¶
func TrustDomainFromURI(uri *url.URL) (TrustDomain, error)
TrustDomainFromURI returns a new TrustDomain from a URI. The URI must be a valid SPIFFE ID (see FromURI) or an error is returned. The trust domain is extracted from the host field and normalized to lower case.
func (TrustDomain) Compare ¶
func (td TrustDomain) Compare(other TrustDomain) int
Compare returns an integer comparing the trust domain to another lexicographically. The result will be 0 if td==other, -1 if td < other, and +1 if td > other.
func (TrustDomain) IDString ¶
func (td TrustDomain) IDString() string
IDString returns a string representation of the the SPIFFE ID of the trust domain, e.g. "spiffe://example.org".
func (TrustDomain) IsZero ¶
func (td TrustDomain) IsZero() bool
IsZero returns true if the trust domain is the zero value.
func (TrustDomain) NewID ¶
func (td TrustDomain) NewID(path string) ID
NewID returns a SPIFFE ID with the given path inside the trust domain.
func (TrustDomain) String ¶
func (td TrustDomain) String() string
String returns the trust domain as a string, e.g. example.org.