Documentation
¶
Index ¶
- Variables
- func CreateECToken(key *ecdsa.PrivateKey, headerAlg, headerType string, ...) (string, error)
- func CreateECkeys(prPath, pubPath string) error
- func CreateHSToken(key []byte, headerAlg, headerType string, tokenClaims map[string]interface{}) (string, error)
- func CreateRSAToken(key *rsa.PrivateKey, headerAlg, headerType string, ...) (string, error)
- func CreateRSAkeys(prPath, pubPath string) error
- func MakeFolder(path string) (string, string, error)
- func ParsePrivateECKey(path, keyName string) (*ecdsa.PrivateKey, error)
- func ParsePrivateRSAKey(path, keyName string) (*rsa.PrivateKey, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultTokenClaims = map[string]interface{}{ "iss": "https://dummy.ega.nbis.se", "sub": "dummy", "exp": time.Now().Add(time.Hour * 2).Unix(), } WrongUserClaims = map[string]interface{}{ "sub": "[email protected]", "aud": "15137645-3153-4d49-9ddb-594027cd4ca7", "azp": "15137645-3153-4d49-9ddb-594027cd4ca7", "scope": "ga4gh_passport_v1 openid", "iss": "https://dummy.ega.nbis.se", "iat": time.Now().Unix(), "exp": time.Now().Add(time.Hour * 2).Unix(), "jti": "5e6c6d24-42eb-408e-ba20-203904e388a1", } ExpiredClaims = map[string]interface{}{ "sub": "dummy", "aud": "15137645-3153-4d49-9ddb-594027cd4ca7", "azp": "15137645-3153-4d49-9ddb-594027cd4ca7", "scope": "ga4gh_passport_v1 openid", "iss": "https://dummy.ega.nbis.se", "exp": time.Now().Add(-time.Hour * 2).Unix(), "iat": time.Now().Unix(), "jti": "5e6c6d24-42eb-408e-ba20-203904e388a1", } ExpiredAndWrongUserClaims = map[string]interface{}{ "sub": "[email protected]", "aud": "15137645-3153-4d49-9ddb-594027cd4ca7", "azp": "15137645-3153-4d49-9ddb-594027cd4ca7", "scope": "ga4gh_passport_v1 openid", "iss": "https://dummy.ega.nbis.se", "exp": time.Now().Add(-time.Hour * 2).Unix(), "iat": time.Now().Unix(), "jti": "5e6c6d24-42eb-408e-ba20-203904e388a1", } NonValidClaims = map[string]interface{}{ "sub": "[email protected]", "aud": "15137645-3153-4d49-9ddb-594027cd4ca7", "azp": "15137645-3153-4d49-9ddb-594027cd4ca7", "scope": "ga4gh_passport_v1 openid", "iss": "https://dummy.ega.nbis.se", "exp": time.Now().Add(time.Hour * 2).Unix(), "iat": time.Now().Add(time.Hour * 2).Unix(), "jti": "5e6c6d24-42eb-408e-ba20-203904e388a1", } WrongTokenAlgClaims = map[string]interface{}{ "iss": "Online JWT Builder", "iat": time.Now().Unix(), "exp": time.Now().Add(time.Hour * 2).Unix(), "aud": "4e9416a7-3515-447a-b848-d4ac7a57f", "sub": "[email protected]", "auth_time": "1632207224", "jti": "cc847f9c-7608-4b4f-9c6f-6e734813355f", } )
Global variables for test token creation
Functions ¶
func CreateECToken ¶
func CreateECToken(key *ecdsa.PrivateKey, headerAlg, headerType string, tokenClaims map[string]interface{}) (string, error)
CreateECToken creates an EC token
func CreateECkeys ¶
CreateECkeys creates the EC key pair
func CreateHSToken ¶
func CreateHSToken(key []byte, headerAlg, headerType string, tokenClaims map[string]interface{}) (string, error)
CreateHSToken creates an HS token
func CreateRSAToken ¶
func CreateRSAToken(key *rsa.PrivateKey, headerAlg, headerType string, tokenClaims map[string]interface{}) (string, error)
CreateRSAToken creates an RSA token
func CreateRSAkeys ¶
CreateRSAkeys creates the RSA key pair
func MakeFolder ¶
MakeFolder creates a folder and subfolders for the keys pair Returns the two paths
func ParsePrivateECKey ¶
func ParsePrivateECKey(path, keyName string) (*ecdsa.PrivateKey, error)
ParsePrivateECKey reads and parses the EC private key
func ParsePrivateRSAKey ¶
func ParsePrivateRSAKey(path, keyName string) (*rsa.PrivateKey, error)
ParsePrivateRSAKey reads and parses the RSA private key
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.