Documentation ¶
Index ¶
- Constants
- Variables
- func AddRestTokenToRequest(r *http.Request, token string)
- func AddSignedMuxHeader(w io.Writer, address []byte, token string) error
- func At(t time.Time, f func())
- func Auth0IsConfigured() bool
- func AuthToken(cancel <-chan interface{}) <-chan string
- func AuthTokenNonBlocking() (string, error)
- func BuildRestToken(r *http.Request) (string, error)
- func ClearKeys()
- func ClearToken()
- func CreateJWTIdentity(hostID, poolID string, admin, dfs bool, pubKeyPEM []byte, ...) (string, int64, error)
- func CreateOrLoadMasterKeys(filename string) error
- func DumpPEMKeyPairToFile(filename string, public, private []byte) error
- func DumpRSAPEMKeyPair(public, private []byte) ([]byte, error)
- func ExtractRestToken(r *http.Request) (string, error)
- func GenerateRSAKeyPairPEM(headers map[string]string) (public []byte, private []byte, err error)
- func GetMasterPublicKey() (crypto.PublicKey, error)
- func GetRequestHash(r *http.Request) []byte
- func HasDFSAccess() bool
- func LoadCommonRSAKeyPairPEM(headers map[string]string) (public []byte, private []byte, err error)
- func LoadDelegateKeysFromFile(filename string) error
- func LoadDelegateKeysFromPEM(public, private []byte) error
- func LoadKeyPairFromFile(filename string) (public crypto.PublicKey, private crypto.PrivateKey, err error)
- func LoadMasterKeyFile(filename string) error
- func LoadMasterKeys(public crypto.PublicKey, private crypto.PrivateKey)
- func LoadMasterKeysFromPEM(public, private []byte) error
- func LoadRSAKeyPair(pub, priv []byte) (public crypto.PublicKey, private crypto.PrivateKey, err error)
- func LoadRSAKeyPairPackage(data []byte) (public crypto.PublicKey, private crypto.PrivateKey, err error)
- func LoadTokenFile(tokenfile string) error
- func MasterToken() (string, error)
- func NewAuthHeaderWriterTo(token, payload []byte, signer Signer) io.WriterTo
- func NotifyOnChange(filename string, ops fsnotify.Op, cancel <-chan interface{}) (<-chan struct{}, error)
- func NotifyOnKeyChange() <-chan struct{}
- func PEMFromRSAPrivateKey(key crypto.PrivateKey, headers map[string]string) ([]byte, error)
- func PEMFromRSAPublicKey(key crypto.PublicKey, headers map[string]string) ([]byte, error)
- func RSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
- func RSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)
- func ReadLengthAndBytes(reader io.Reader) ([]byte, error)
- func RefreshToken(f TokenFunc, filename string) (int64, error)
- func RegisterLocalHost(keydata []byte) error
- func RegisterRemoteHost(hostID string, nat utils.URL, hostIPAddr string, keydata []byte, prompt bool) error
- func SignAsDelegate(message []byte) ([]byte, error)
- func SignAsMaster(message []byte) ([]byte, error)
- func TokenLoop(f TokenFunc, tokenfile string, done <-chan interface{}, ...)
- func VerifyMasterSignature(message, signature []byte) error
- func WaitForAuthToken(cancel <-chan interface{}) <-chan struct{}
- func WaitForDelegateKeys(cancel <-chan interface{}) <-chan struct{}
- func WatchDelegateKeyFile(filename string, cancel <-chan interface{}) error
- func WatchTokenFile(tokenfile string, done <-chan interface{}) error
- func WriteKeyToFile(filename string, keydata []byte) error
- func WriteLengthAndBytes(b []byte, writer io.Writer) error
- type Auth0Token
- type AuthHeaderError
- type AuthTokenRetriever
- type HostExpirationRegistry
- type HostExpirationRegistryInterface
- type HostKeys
- type Identity
- type JSONWebkeys
- type Jwks
- type MasterKeys
- type RPCHeaderBuilder
- type RPCHeaderHandler
- type RPCHeaderParser
- type RestToken
- type Signer
- type TokenFunc
- type Verifier
Constants ¶
const ( TOKEN_LEN_BYTES = 4 SIGNATURE_BYTES = 256 )
const ( DelegateKeyFileName = "delegate.keys" MasterKeyFileName = ".keys/master.keys" CommonKeyFilename = "common.key" )
const ( // ClockDriftDelta provides the tolerance for clock drift // between master and hosts when a token or request is considered valid ClockDriftDelta = 5 * time.Minute // token to be refreshed ahead of the expiration time RefreshAhead = 3 * time.Minute )
const (
ADDRESS_BYTES = 6
)
Variables ¶
var ( // ErrIdentityTokenInvalid is a generic invalid token error ErrIdentityTokenInvalid = errors.New("Identity token is invalid") // ErrIdentityTokenExpired is thrown when an identity token is expired ErrIdentityTokenExpired = errors.New("Identity token expired") // ErrIdentityTokenNotValidYet is thrown when an identity token is used before its issue time ErrIdentityTokenNotValidYet = errors.New("Identity token used before issue time") // ErrIdentityTokenBadSig is thrown when an identity token has a bad signature ErrIdentityTokenBadSig = errors.New("Identity token signature cannot be verified") // ErrNoPublicKey is thrown when no public key is available to verify a signature ErrNoPublicKey = errors.New("Cannot retrieve public key to verify signature") // ErrNoPrivateKey is thrown when no private key is available to sign a message ErrNoPrivateKey = errors.New("Cannot retrieve private key to sign message") // ErrInvalidSigningMethod is thrown when an identity token is not signed with the correct method ErrInvalidSigningMethod = errors.New("Identity token signing method was not RSAPSS") // ErrInvalidIdentityTokenClaims is thrown when an identity token does not have required claims ErrInvalidIdentityTokenClaims = errors.New("Identity token is missing required claims") // ErrNotRSAPublicKey is thrown when a key is not an RSA public key and needs to be ErrNotRSAPublicKey = errors.New("Not an RSA public key") // ErrNotRSAPrivateKey is thrown when a key is not an RSA private key and needs to be ErrNotRSAPrivateKey = errors.New("Not an RSA private key") // ErrNotPEMEncoded is thrown when bytes are not PEM encoded and need to be ErrNotPEMEncoded = errors.New("Not PEM encoded") // ErrBadKeysFile is thrown when the local keys file isn't parseable ErrBadKeysFile = errors.New("Unable to read security keys file") // ErrNotAuthenticated is thrown when there's no authentication token ErrNotAuthenticated = errors.New("No authentication token available") // ErrBadToken is thrown when there is a problem extracting a token from a data stream (e.g. mux, rpc, etc) ErrBadToken = errors.New("Could not extract token") // ErrRestTokenExpired is thrown when an rest token is expired ErrRestTokenExpired = errors.New("Rest token expired") // ErrBadRestToken is thrown when the rest token cant be extracted or parsed ErrBadRestToken = errors.New("Invalid rest token") // ErrRestTokenBadSig is thrown when a rest token has a bad signature ErrRestTokenBadSig = errors.New("Rest token signature cannot be verified") // ErrSSHFailed is thrown when we can't ssh to a remote host to register keys ErrSSHFailed = errors.New("Unable to make an ssh connection to host") // ErrAuth0TokenExpired is thrown when an auth0 token is expired ErrAuth0TokenExpired = errors.New("auth0 token expired") // ErrAuth0TokenBadIssuer is thrown when the issuer claim in an auth0 token does not match the value configured in the API ErrAuth0TokenBadIssuer = errors.New("auth0 token issuer does not match value configured in API") // ErrAuth0TokenBadAudience is thrown when the audience claim in an auth0 token does not match the value of the target API ErrAuth0TokenBadAudience = errors.New("auth0 token audience does not match the target API") )
var ( // ProtocolVersion is the current protocol version ProtocolVersion protocolVersion = 1 // MagicNumber is a magic number to identify headers as auth MagicNumber = magicNumber([3]byte{139, 143, 165}) // ErrInvalidAuthHeader is thrown when the auth header is invalid ErrInvalidAuthHeader = errors.New("Invalid authentication header") // ErrAuthProtocolVersion is thrown when the auth protocol version passed is unknown ErrAuthProtocolVersion = errors.New("Unknown authentication protocol version") // ErrPayloadTooLarge is thrown when the payload length for an auth header overflows a uint16 ErrPayloadTooLarge = errors.New("Authentication header payload is too large") // ErrUnknownAuthProtocol is thrown when the authentication protocol version is not supported ErrUnknownAuthProtocol = errors.New("Unknown authentication protocol version") // ErrHeaderExpired is thrown when an authentication header is more than 10s old ErrHeaderExpired = errors.New("Expired authentication header.") )
var ( RequestDelimiter = " " RestTokenExpiration = 10 * time.Second AuthTokenGetter AuthTokenRetriever = AuthTokenNonBlocking )
var ( // RPCMagicNumber is a magic number for RPC RPCMagicNumber = []byte{224, 227, 155} // BodyLenLen is the length of the length of the payload BodyLenLen = 4 // ErrBadRPCHeader is thrown when the RPC header is bad ErrBadRPCHeader = errors.New("Bad rpc header") // ErrWritingLength is thrown when the length writing has an error ErrWritingLength = errors.New("Wrote too few bytes for message length") // ErrWritingBody is thrown when the body writing has an error ErrWritingBody = errors.New("Wrote too few bytes for message body") // ErrReadingLength is thrown when we read too few bytes for message length ErrReadingLength = errors.New("Read too few bytes for message length") // ErrReadingBody is thrown when we read too few bytes for message body ErrReadingBody = errors.New("Read too few bytes for message body") )
var ( // DevPubKeyPEM is a sample public key for use in dev DevPubKeyPEM = []byte(`-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxeGhO/4jJ7fPwXHjtZx+ q/Ne+fhMEzGB41aD6QKij6u0LPBWynmXdJeLdIW1N8ZFF7PdpA4qAu6ouMRvOuSJ 1qPt1hToahBxxducEp64nQ/fWN0uANjPqjlKcjj/fiSZ2ewrXYAOmnbaIQgt3fjv VYQgdGmHA5uyROclsutOF0shyprU2x/S8uXIK1fJM/yxukcDG6GvymW0b5mqLZZA Zmpt11QJ8YV5yiBtziSyYfiXTFs5yoydvRqmTIRm1CBnV3JYXio9fXv4C1BVTk11 miqYybTUZga1O9mykjDbrwtaigb2rP1EjQzJoMLHW27edXBZUFQjedD0N20+WkUx 0wIDAQAB -----END PUBLIC KEY-----`) // DevPrivKeyPEM is a sample private key for use in dev DevPrivKeyPEM = []byte(`-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAxeGhO/4jJ7fPwXHjtZx+q/Ne+fhMEzGB41aD6QKij6u0LPBW ynmXdJeLdIW1N8ZFF7PdpA4qAu6ouMRvOuSJ1qPt1hToahBxxducEp64nQ/fWN0u ANjPqjlKcjj/fiSZ2ewrXYAOmnbaIQgt3fjvVYQgdGmHA5uyROclsutOF0shyprU 2x/S8uXIK1fJM/yxukcDG6GvymW0b5mqLZZAZmpt11QJ8YV5yiBtziSyYfiXTFs5 yoydvRqmTIRm1CBnV3JYXio9fXv4C1BVTk11miqYybTUZga1O9mykjDbrwtaigb2 rP1EjQzJoMLHW27edXBZUFQjedD0N20+WkUx0wIDAQABAoIBAQC5W2HZvXOWx9Jf JNylCOOLFFx6EIDKVcySdD757BL0O2V51uOlpAIgH7hsvLaEeT/NNRm/i9kEiCQZ dz+tzdfj7AhkSY9vktnP+aeXtX++99hB+GUYO/9CN4optoR017oZ7OSuH78OJ5ip 6mx0ibM+ypZQFW14DscNTev9TfcHTx2Id9/iQx1bZFXxWyhjpuAlxliw3hkS4ANt axI9N8Wi+K7uHYkMsDul32JIHFPPgpD4uB8mcCsLG48sRPqC/wcqeb48Dift6c/y wo3JWk8Q5wi8/pE+ryVccSHa5KHaO+bhVr/z5ItNgA9MQdE3k5N7Umx41rgQR0Xr +CYwH2JhAoGBAPLGIi5TK/hb+0Z9NQvoqOOObju8U4gOv5n+diW+xMU4EoJBsllM piKfrlXBn+09hovx72p2LWYXQERp7yfd0AzcWC41HqGjtQ+1gA+9GDYC/wLDA+pl tW7tlmzcIAIsYPUFBSPSb+WA4aJygir/1Hta/PldYGGrhUxfhrzZbeXxAoGBANCp Ze3pG7N2mDuSxEhtXOOD9JMupz3tMZr2p+QgtjR5MRWR9+G3mFna5462Rg9d/d7z 4adxsvn/7OE/9stkLpdmcZrq0jx5s9V/EQkliO7LG9l3H/JoPEYPt5alGpeV3awG 7uTrkpdqO44U2PTCPCZ7i07axeHC9J68GzDMM4ADAoGBAMNto45O/ZJL2RaBK/aO L4Ye3bXQgB2CYdKA+HKiApwP6zZX1E32WbZ9fEUkPK0pXenBs8yrnRgVl3J7JD2f XR89MO7ha+sKcXJX1OLWgWrZNpbujXRes5K8Rt8Sw+F8AAC9LcoMWG8TNI8kRox+ rHkwYXwLIs78160HKNtU3BbBAoGBAMgCCA0TC5VrUSKRXQnbolUG8BGAf5hxWsIi Oe4GmQAVRsJZR1SZqjQ/CwQVnXQvcSAbfyoEZz0RXprOuB5fafV/odePzHNhaMp1 YPv2eZoDIC/D6uBtn5C8kgqZObMhWPkDMExHrhzrHCjlvMxnvkZY18B/HXx4Zggd YKbWpWrHAoGAYhE/GcHnJ/SJznMl0O9jkg/I0TQwDRnibzvESb3M2aZZ7slL/AYb x9eZ/rWmKDZN74BDBmCIVBn8jgXk0Qv9JmltOS7b6Md4R5DTaeP6QJEEBGpKkFI4 gTU6k22ENbaM2VIHhEjJQYftvA63316pfDqF31yq/cpspdaNrntc7xc= -----END RSA PRIVATE KEY-----`) )
var (
ErrBadMuxAddress = errors.New("Bad mux address")
)
var ( // ErrMissingHost indicates if a host does not // exist in the host expiration registry ErrMissingHost = errors.New("Host is not present in host expiration registry") )
var (
// TokenFileName is the file in which we store the current token
TokenFileName = "auth.token"
)
Functions ¶
func AddRestTokenToRequest ¶
func At ¶
At sets a fake time, executes the provided function, then restores the default time getter, making it possible to test time-sensitive stuff
func Auth0IsConfigured ¶
func Auth0IsConfigured() bool
func AuthToken ¶
func AuthToken(cancel <-chan interface{}) <-chan string
AuthToken returns an unexpired auth token, blocking if necessary until authenticated
func AuthTokenNonBlocking ¶
A non-blocking call to get an unexpired auth token. Returns an error
If no token exists or if the token is expired
func CreateJWTIdentity ¶
func CreateJWTIdentity(hostID, poolID string, admin, dfs bool, pubKeyPEM []byte, expiration time.Duration) (string, int64, error)
CreateJWTIdentity returns a signed string
func CreateOrLoadMasterKeys ¶
CreateOrLoadMasterKeys will load the master keys from disk
If the file does not exist, it will generate new keys and write them to disk.
func DumpPEMKeyPairToFile ¶
DumpPEMKeyPairToFile dumps PEM-encoded public and private keys to a single file
func DumpRSAPEMKeyPair ¶
DumpRSAPEMKeyPair dumps PEM-encoded public and private keys to a single byte array
func GenerateRSAKeyPairPEM ¶
GenerateKey generates an RSA key pair and returns the public and private PEM blocks for that key.
func GetMasterPublicKey ¶
GetMasterPublicKey() returns the public key of the master
It first checks to see if we have a set of master keys (i.e. we are the master) It then checks the delegate keys. If neither exists, returns ErrNoPublicKey
func GetRequestHash ¶
func HasDFSAccess ¶
func HasDFSAccess() bool
Check if the current identity is allowed to access the DFS
func LoadCommonRSAKeyPairPEM ¶
LoadCommonRSAKeyPairPEM loads the common keys from a specific file.
func LoadDelegateKeysFromFile ¶
LoadKeysFromFile loads keys from a file on disk.
func LoadDelegateKeysFromPEM ¶
LoadDelegateKeysFromPEM loads the local delegate keys (master public, delegate private)
from PEM data passed in directly Useful mostly for writing tests
func LoadKeyPairFromFile ¶
func LoadKeyPairFromFile(filename string) (public crypto.PublicKey, private crypto.PrivateKey, err error)
LoadPEMKeyPair loads a private/public key pair from a reader over PEM-encoded data.
The private key is first, the public key is second.
func LoadMasterKeyFile ¶
LoadMasterKeyFile will load the master keys from disk if
the file exists. If the file does not exist, it will return an error
func LoadMasterKeys ¶
func LoadMasterKeys(public crypto.PublicKey, private crypto.PrivateKey)
LoadMasterKeys sets the current master key pair to the one specified
func LoadMasterKeysFromPEM ¶
LoadMasterKeysFromPEM loads the local master keys from PEM data passed in directly
Useful mostly for writing tests
func LoadRSAKeyPair ¶
func LoadRSAKeyPair(pub, priv []byte) (public crypto.PublicKey, private crypto.PrivateKey, err error)
LoadRSAKeyPair loads a private/public key pair from separate PEM-encoded byte arrays
func LoadRSAKeyPairPackage ¶
func LoadRSAKeyPairPackage(data []byte) (public crypto.PublicKey, private crypto.PrivateKey, err error)
LoadRSAKeyPairPackage loads a private/public key pair from a reader over PEM-encoded data.
The private key is first, the public key is second.
func LoadTokenFile ¶
func MasterToken ¶
MasterToken() generates a new token with an empty host and pool ID and the master's public key,
signed by the master's private key. This will return an error if there is no master private key available (i.e. if we are not the master)
func NewAuthHeaderWriterTo ¶
NewAuthHeaderWriterTo returns an io.WriterTo that can write an authentication header with the given parameters to a Writer.
func NotifyOnChange ¶
func NotifyOnChange(filename string, ops fsnotify.Op, cancel <-chan interface{}) (<-chan struct{}, error)
NotifyOnChange watches a file for changes that match the given operation set and notifies on a channel when they occur.
func NotifyOnKeyChange ¶
func NotifyOnKeyChange() <-chan struct{}
func PEMFromRSAPrivateKey ¶
PEMFromRSAPrivateKey creates a PEM block from an RSA public key
func PEMFromRSAPublicKey ¶
PEMFromRSAPublicKey creates a PEM block from an RSA public key
func RSAPrivateKeyFromPEM ¶
func RSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
RSAPrivateKeyFromPEM decodes a PEM-encoded RSA private key
func RSAPublicKeyFromPEM ¶
RSAPublicKeyFromPEM decodes a PEM-encoded RSA public key
func ReadLengthAndBytes ¶
ReadLengthAndBytes reads the length of a byte array and then the bytes themselves. It is the inverse of WriteLengthAndBytes.
func RefreshToken ¶
RefreshToken gets a new token, sets it as the current, and returns the expiration time
func RegisterLocalHost ¶
func RegisterRemoteHost ¶
func SignAsDelegate ¶
SignAsDelegate signs the given message with the private key local to the delegate running this process.
func SignAsMaster ¶
SignAsMaster signs the given message with the master's private key will return an error if the delegate running this process is not the master
func TokenLoop ¶
func TokenLoop(f TokenFunc, tokenfile string, done <-chan interface{}, forceRefresh <-chan struct{})
TokenLoop accepts a function that returns an expiring token. It will then periodically refresh that token, one minute before it is due to expire, setting the result as the current live token, until the done channel is closed.
func VerifyMasterSignature ¶
VerifyMasterSignature verifies that a given message was signed by the master whose public key we have.
func WaitForAuthToken ¶
func WaitForAuthToken(cancel <-chan interface{}) <-chan struct{}
WaitForAuthToken blocks until the authentication token is defined.
func WaitForDelegateKeys ¶
func WaitForDelegateKeys(cancel <-chan interface{}) <-chan struct{}
WaitForDelegateKeys blocks until delegate keys are defined.
func WatchDelegateKeyFile ¶
WatchDelegateKeyFile watches the delegate key file on the filesystem and updates the internal delegate keys when changes are detected.
func WatchTokenFile ¶
Watch a token file for changes. Load the token when those changes occur.
func WriteKeyToFile ¶
Types ¶
type Auth0Token ¶
func ParseAuth0Token ¶
func ParseAuth0Token(token string) (Auth0Token, error)
See https://auth0.com/docs/api-auth/tutorials/verify-access-token for information on validating auth0 tokens. Per https://jwt.io/, the jwt-go library validates exp, but not iss or sub.
type AuthHeaderError ¶
AuthHeaderError wraps another error with an accompanying payload, for the sake of those receiving the error who need access to the payload.
func (*AuthHeaderError) Error ¶
func (e *AuthHeaderError) Error() string
Error implements the error interface.
type AuthTokenRetriever ¶
type HostExpirationRegistry ¶
HostExpirationRegistry is a threadsafe map of host id to auth expiration time. NOTE: expired hosts are not removed from the registry
func NewHostExpirationRegistry ¶
func NewHostExpirationRegistry() *HostExpirationRegistry
NewHostExpirationRegistry creates a new HostExpirationRegistry
func (*HostExpirationRegistry) IsExpired ¶
func (reg *HostExpirationRegistry) IsExpired(hostid string) (bool, error)
IsExpired checks if a give host's auth has expired and returns a bool or an error if the host isn't in the registry
func (*HostExpirationRegistry) Remove ¶
func (reg *HostExpirationRegistry) Remove(hostid string)
Remove removes a host from the expiration registry
func (*HostExpirationRegistry) Set ¶
func (reg *HostExpirationRegistry) Set(hostid string, expires int64)
Set adds a host to the expiration registry by its id and sets its auth expiration time
type Identity ¶
type Identity interface { Valid() error Expired() bool HostID() string PoolID() string HasAdminAccess() bool HasDFSAccess() bool Verifier() (Verifier, error) }
Identity represents the identity of a host. The most-used implementation will involve serializing this to a token.
func CurrentIdentity ¶
func CurrentIdentity() Identity
CurrentIdentity returns the identity represented by the currently-live token, or nil if the token is not yet available
func ParseJWTIdentity ¶
ParseJWTIdentity parses a JSON Web Token string, verifying that it was signed by the master.
func ReadAuthHeader ¶
ReadAuthHeader reads an authentication header from the reader given. If there's a non-EOF error, it will read to the payload and return an AuthHeaderError with the contents of the payload and the original error. This allows us to support protocols that require the payload for bookkeeping purposes, like RPC.
type JSONWebkeys ¶
type Jwks ¶
type Jwks struct { Keys []JSONWebkeys `json:"keys"` // contains filtered or unexported fields }
type MasterKeys ¶
type MasterKeys struct {
// contains filtered or unexported fields
}
func (*MasterKeys) Verify ¶
func (m *MasterKeys) Verify(message, signature []byte) error
type RPCHeaderBuilder ¶
type RPCHeaderBuilder interface { // WriteHeader writes an RPC header to the provided writer. Optionally, it // writes an authentication header as part of the RPC header. WriteHeader(io.Writer, []byte, bool) error }
RPCHeaderBuilder builds headers and writes them to writers
type RPCHeaderHandler ¶
type RPCHeaderHandler struct{}
RPCHeaderHandler is an implementation of RPCHeaderParser and RPCHeaderBuilder
func (*RPCHeaderHandler) ReadHeader ¶
ReadHeader reads an RPC header from a reader, parsing the authentication header, if any.
func (*RPCHeaderHandler) WriteHeader ¶
WriteHeader writes an RPC header to the provided writer. Optionally, it writes an authentication header as part of the RPC header.
type RPCHeaderParser ¶
type RPCHeaderParser interface { // ReadHeader reads an RPC header from a reader, parsing the authentication // header, if any. ReadHeader(io.Reader) (Identity, []byte, error) }
RPCHeaderParser reads headers from readers and parses them
type RestToken ¶
type RestToken interface { Valid() error Expired() bool AuthToken() string RestToken() string ValidateRequestHash(r *http.Request) bool HasAdminAccess() bool }
func ParseRestToken ¶
type Signer ¶
Signer is used to sign a message
func RSASigner ¶
func RSASigner(key crypto.PrivateKey) (Signer, error)
RSASigner creates a Signer from a key, validating that it is an RSA private key first
func RSASignerFromPEM ¶
RSASignerFromPEM creates a Signer from a PEM-encoded key, validating that it is an RSA private key first
type TokenFunc ¶
TokenFunc is a function that can return an authentication token and its expiration time
type Verifier ¶
Verifier is used to verify a signed message
func DevRSAVerifier ¶
func DevRSAVerifier() Verifier
DevRSAVerifier returns a dev verifier for dev purposes
func RSAVerifier ¶
RSAVerifier creates a Verifier from a key, verifying that it is an RSA public key first
func RSAVerifierFromPEM ¶
RSAVerifierFromPEM creates a Verifier from a PEM-encoded key, verifying that it is an RSA public key first