Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions account/service/token_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ func TestNewPairFromUser(t *testing.T) {
var idExp int64 = 15 * 60
var refreshExp int64 = 3 * 24 * 2600
priv, _ := ioutil.ReadFile("../rsa_private_test.pem")
privKey, _ := jwt.ParseRSAPrivateKeyFromPEM(priv)
privKey, err := jwt.ParseRSAPrivateKeyFromPEM(priv)
if err != nil {
privKey, _ = generatePrivateKey(2048)
}
pub, _ := ioutil.ReadFile("../rsa_public_test.pem")
pubKey, _ := jwt.ParseRSAPublicKeyFromPEM(pub)
pubKey, err := jwt.ParseRSAPublicKeyFromPEM(pub)
if err != nil {
pubKey = &privKey.PublicKey
}
secret := "anotsorandomtestsecret"

mockTokenRepository := new(mocks.MockTokenRepository)
Expand Down Expand Up @@ -235,9 +241,15 @@ func TestValidateIDToken(t *testing.T) {
var idExp int64 = 15 * 60

priv, _ := ioutil.ReadFile("../rsa_private_test.pem")
privKey, _ := jwt.ParseRSAPrivateKeyFromPEM(priv)
privKey, err := jwt.ParseRSAPrivateKeyFromPEM(priv)
if err != nil {
privKey, _ = generatePrivateKey(2048)
}
pub, _ := ioutil.ReadFile("../rsa_public_test.pem")
pubKey, _ := jwt.ParseRSAPublicKeyFromPEM(pub)
pubKey, err := jwt.ParseRSAPublicKeyFromPEM(pub)
if err != nil {
pubKey = &privKey.PublicKey
}

// instantiate a common token service to be used by all tests
tokenService := NewTokenService(&TSConfig{
Expand Down