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 FormatUploadFilePath(filePath string) (string, error)
- func MakeCerts(outDir string)
- func MakeFolder(path string) (string, string, error)
- func ParsePrivateECKey(path, keyName string) (*ecdsa.PrivateKey, error)
- func ParsePrivateRSAKey(path, keyName string) (*rsa.PrivateKey, error)
- func TLScertToFile(filename string, derBytes []byte) error
- func TLSkeyToFile(filename string, key *ecdsa.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(), "pilot": "dummy-pilot", } WrongUserClaims = map[string]interface{}{ "sub": "c5773f41d17d27bd53b1e6794aedc32d7906e779@elixir-europe.org", "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", } NonValidClaims = map[string]interface{}{ "sub": "c5773f41d17d27bd53b1e6794aedc32d7906e779@elixir-europe.org", "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": "pleasefix@snurre-in-the-house.org", "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 FormatUploadFilePath ¶ added in v0.2.29
FormatUploadFilePath ensures that path separators are "/", and returns error if the filepath contains a disallowed character matched with regex
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
func TLScertToFile ¶ added in v0.1.126
func TLSkeyToFile ¶ added in v0.1.126
func TLSkeyToFile(filename string, key *ecdsa.PrivateKey) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.