Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileKeyStore ¶
type FileKeyStore struct { // PrivateKey is the default private key PrivateKey interface{} // KeysMap is a map <key-name>:<key-data> KeysMap map[string]interface{} }
FileKeyStore holds the data for a file-based KeyStore implementation.
func (*FileKeyStore) GetPrivateKey ¶
func (fks *FileKeyStore) GetPrivateKey() (interface{}, error)
GetPrivateKey returns the default private key. This key is also available under the name "default".
func (*FileKeyStore) GetPrivateKeyByName ¶
func (fks *FileKeyStore) GetPrivateKeyByName(keyName string) (interface{}, error)
GetPrivateKeyByName returns a private by by name. The key is looked up in the underlying map, and an error is raised if there is no key under the name requested.
type KeyStore ¶
type KeyStore interface { // GetPrivateKey returns the default private key used for signing. GetPrivateKey() (interface{}, error) // GetPrivateKeyByName gets a private key by name GetPrivateKeyByName(keyName string) (interface{}, error) }
KeyStore defines an interface for reading private keys for JWT signing. The keys may be loaded from file or from a repository, however the implementation must at least guarantee a basic level of caching.
func NewFileKeyStore ¶
NewFileKeyStore returns a file-based KeyStore implementation. The keys are loaded based on the map of <key-name>:<key-file> provided. The functions expects to be at least one key with name "default" defined. The keys must be RSA keys and the files must be PEM.