iris/_examples/auth/jwt
Gerasimos (Makis) Maropoulos 1864f99145
New JWT features and changes (examples updated). Improvements on the Context User and Private Error features
TODO: Write the new e-book JWT section and the HISTORY entry of the chnages and  add a simple example on site docs
2020-10-17 06:40:17 +03:00
..
refresh-token New JWT features and changes (examples updated). Improvements on the Context User and Private Error features 2020-10-17 06:40:17 +03:00
main.go New JWT features and changes (examples updated). Improvements on the Context User and Private Error features 2020-10-17 06:40:17 +03:00
README.md reorganization of _examples and add some new examples such as iris+groupcache+mysql+docker 2020-06-07 15:26:06 +03:00
rsa_password_protected.key reorganization of _examples and add some new examples such as iris+groupcache+mysql+docker 2020-06-07 15:26:06 +03:00

Generate RSA

$ openssl genrsa -des3 -out private_rsa.pem 2048
b, err := ioutil.ReadFile("./private_rsa.pem")
if err != nil {
    panic(err)
}
key := jwt.MustParseRSAPrivateKey(b, []byte("pass"))

OR

import "crypto/rand"
import "crypto/rsa"

key, err := rsa.GenerateKey(rand.Reader, 2048)

Generate Ed25519

$ openssl genpkey -algorithm Ed25519 -out private_ed25519.pem
$ openssl req -x509 -key private_ed25519.pem -out cert_ed25519.pem -days 365