Documentation
¶
Overview ¶
Package ociauth parses and verifies OCI API request signatures (the draft-cavage HTTP Signatures scheme used by every OCI SDK).
Like the other cloud auth packages it is permissive by default: a request is only cryptographically checked when its keyId names an API key registered in the Registry. Unknown keys and unsigned requests pass unless the caller asks for enforcement.
Index ¶
Constants ¶
const MaxClockSkew = 5 * time.Minute
MaxClockSkew is the largest date drift OCI accepts on a signed request.
Variables ¶
var ( // ErrNotAuthenticated is returned for missing, malformed or invalid credentials. ErrNotAuthenticated = errors.New("ociauth: not authenticated") // ErrBadKey is returned when a public key cannot be parsed. ErrBadKey = errors.New("ociauth: invalid RSA public key") )
Functions ¶
func Fingerprint ¶
Fingerprint returns the colon-separated MD5 of the DER-encoded public key, the identifier OCI shows for an uploaded API key.
Types ¶
type KeyID ¶
KeyID is the decomposed "<tenancy>/<user>/<fingerprint>" signature keyId.
func ParseKeyID ¶
ParseKeyID splits a keyId; instance/resource principals use other shapes and report false.
type KeyRecord ¶
type KeyRecord struct {
Tenancy string `json:"tenancy"`
User string `json:"user"`
PublicPEM string `json:"publicPem"`
}
KeyRecord is the persisted form of a registered API key.
type Options ¶
type Options struct {
Registry *Registry
Now func() time.Time
// Enforce rejects unsigned requests and signatures from keys not in the Registry.
Enforce bool
}
Options tunes Verify.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the API keys the emulator verifies signatures against.
func (*Registry) Link ¶
Link makes keys registered in other verifiable through r as well, so a registry owned by OCI Identity can serve every OCI service. Links must not form a cycle.
type Signature ¶
type Signature struct {
KeyID string
Algorithm string
Version string
Headers []string
Signature []byte
}
Signature is a parsed Authorization header.
func ParseAuthorization ¶
ParseAuthorization parses `Signature version="1",headers="...",keyId="...",algorithm="rsa-sha256",signature="..."`.