Documentation ¶
Index ¶
- func ForgeToken(uid, email, role string, level int, key *rsa.PrivateKey, ...) (string, error)
- type APIKeyHMAC
- type Auth
- type KeyStore
- func (ks *KeyStore) GenerateKeys() error
- func (ks *KeyStore) LoadPrivateKey(path string) error
- func (ks *KeyStore) LoadPublicKeyFromFile(path string) error
- func (ks *KeyStore) LoadPublicKeyFromString(str string) error
- func (ks *KeyStore) SavePrivateKey(path string) error
- func (ks *KeyStore) SavePublicKey(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForgeToken ¶
func ForgeToken(uid, email, role string, level int, key *rsa.PrivateKey, customClaims jwt.MapClaims) (string, error)
ForgeToken creates a valid JWT signed by the given private key
Types ¶
type APIKeyHMAC ¶
APIKeyHMAC contains API keys credential to authenticate to HTTP API using HMAC
func NewAPIKeyHMAC ¶
func NewAPIKeyHMAC(accessKey, secretKey string) *APIKeyHMAC
NewAPIKeyHMAC creates an instance of APIKeyHMAC
func (*APIKeyHMAC) GetSignature ¶
func (key *APIKeyHMAC) GetSignature(nonce int64) string
GetSignature return a signature for the given nonce, if nonce is zero it use the current time in millisecond
func (*APIKeyHMAC) GetSignedHeader ¶
func (key *APIKeyHMAC) GetSignedHeader(nonce int64) http.Header
GetSignedHeader returns a header with valid HMAC authorization fields
type Auth ¶
type Auth struct { UID string `json:"uid"` State string `json:"state"` Email string `json:"email"` Role string `json:"role"` ReferralID json.Number `json:"referral_id"` Level json.Number `json:"level"` Audience []string `json:"aud,omitempty"` jwt.StandardClaims }
Auth struct represents parsed jwt information.
type KeyStore ¶
type KeyStore struct { PublicKey *rsa.PublicKey PrivateKey *rsa.PrivateKey }
func LoadOrGenerateKeys ¶
func (*KeyStore) GenerateKeys ¶
func (*KeyStore) LoadPrivateKey ¶
func (*KeyStore) LoadPublicKeyFromFile ¶
func (*KeyStore) LoadPublicKeyFromString ¶
func (*KeyStore) SavePrivateKey ¶
func (*KeyStore) SavePublicKey ¶
Click to show internal directories.
Click to hide internal directories.