From ec326c30d6ed864d5b7cc294372aa0f9563c6857 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 13 Apr 2023 12:29:09 +0300 Subject: [PATCH] fix typo closes #31 --- pkg/helpers/config.go | 2 +- pkg/helpers/generate.go | 5 ++++- pkg/helpers/ssl.go | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/helpers/config.go b/pkg/helpers/config.go index ab6c5d1..c97844b 100644 --- a/pkg/helpers/config.go +++ b/pkg/helpers/config.go @@ -60,7 +60,7 @@ func LoadConfig() samlsp.Options { if signingCert := Env("SP_SIGNING_CERT", ""); signingCert != "" { samlOptions.IDPMetadata.IDPSSODescriptors[0].KeyDescriptors = []saml.KeyDescriptor{ { - Use: "singing", + Use: "signing", KeyInfo: saml.KeyInfo{ X509Data: saml.X509Data{ X509Certificates: []saml.X509Certificate{ diff --git a/pkg/helpers/generate.go b/pkg/helpers/generate.go index 31c6a2b..e3d1627 100644 --- a/pkg/helpers/generate.go +++ b/pkg/helpers/generate.go @@ -14,6 +14,9 @@ import ( func Generate(host string) (*rsa.PrivateKey, *x509.Certificate) { priv, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + panic(err) + } notBefore := time.Now() notAfter := notBefore.Add(365 * 24 * time.Hour) @@ -35,7 +38,7 @@ func Generate(host string) (*rsa.PrivateKey, *x509.Certificate) { KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, BasicConstraintsValid: true, - DNSNames: strings.Split(host, ","), + DNSNames: strings.Split(host, ","), } hosts := strings.Split(host, ",") diff --git a/pkg/helpers/ssl.go b/pkg/helpers/ssl.go index fb124bc..5f4e3f1 100644 --- a/pkg/helpers/ssl.go +++ b/pkg/helpers/ssl.go @@ -4,11 +4,11 @@ import ( "crypto/rsa" "crypto/x509" "encoding/pem" - "io/ioutil" + "os" ) func LoadRSAKey(path string) *rsa.PrivateKey { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { panic(err) } @@ -21,7 +21,7 @@ func LoadRSAKey(path string) *rsa.PrivateKey { } func LoadCertificate(path string) *x509.Certificate { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { panic(err) }