1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-06-19 00:27:42 +02:00

finish internal/user user and auth unittests

This commit is contained in:
Lee Brown
2019-05-28 04:44:01 -05:00
parent 895128bbbe
commit c121b7d289
11 changed files with 913 additions and 471 deletions

View File

@ -185,7 +185,7 @@ func NewAuthenticator(awsSession *session.Session, awsSecretID string, now time.
// refreshed on instance launch. Could store keys in a kv store and update that value
// when new keys are generated
if len(keyContents) == 0 || curKeyId == "" {
privateKey, err := keygen()
privateKey, err := Keygen()
if err != nil {
return nil, errors.Wrap(err, "failed to generate new private key")
}
@ -307,8 +307,8 @@ func (a *Authenticator) ParseClaims(tknStr string) (Claims, error) {
return claims, nil
}
// keygen creates an x509 private key for signing auth tokens.
func keygen() ([]byte, error) {
// Keygen creates an x509 private key for signing auth tokens.
func Keygen() ([]byte, error) {
key, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
return []byte{}, errors.Wrap(err, "generating keys")

View File

@ -57,8 +57,6 @@ func New() *Test {
dbHost := fmt.Sprintf("postgres://%s:%s@127.0.0.1:%s/%s?timezone=UTC&sslmode=disable", container.User, container.Pass, container.Port, container.Database)
fmt.Println(dbHost)
// ============================================================
// Start Postgres