Add configuration settings for Argon2 password KDF (#217)
* Bump generated proto code * Add argon2 conf sql and proto files * Add generated code for argon2 conf * Add Resources for Argon2 configuration * Add get and set Configuration to repository * Add current config reference to AuthMethod * Fix authmethod_test * Fix TestAccount_New * Add WithConfiguration to options * Add sql views for current configuration * Fix SetTableName * Remove duplicate testAccounts function * Make tests clearer * Fix comment * Rename test variable * Use NewPrivateId function for private Ids * Refactor: rename public_id to private_id for password_conf and password_credential * Remove bad comment * Check if embedded argon2 configuration is nil * Add checks around the WithConfiguration option * Use spaces not tabs in proto file * Add doc to explain choice of oplog ticket * Verify oplog in test
This commit is contained in:
1 parent
c3c07f1556
commit
c163d790a4
23 files changed
+1613
-64
No files matched your search
@@ -27,9 +27,17 @@ func testAuthMethods(t *testing.T, conn *gorm.DB, count int) []*AuthMethod {
|
||||
require.NotEmpty(id)
|
||||
cat.PublicId = id
|
||||
|
||||
conf := NewArgon2Configuration()
|
||||
require.NotNil(conf)
|
||||
conf.PrivateId, err = newArgon2ConfigurationId()
|
||||
require.NoError(err)
|
||||
conf.PasswordMethodId = cat.PublicId
|
||||
cat.PasswordConfId = conf.PrivateId
|
||||
|
||||
ctx := context.Background()
|
||||
_, err2 := w.DoTx(ctx, db.StdRetryCnt, db.ExpBackoff{},
|
||||
func(_ db.Reader, iw db.Writer) error {
|
||||
require.NoError(iw.Create(ctx, conf))
|
||||
return iw.Create(ctx, cat)
|
||||
},
|
||||
)
|
||||
@@ -123,14 +131,20 @@ func TestAuthMethod_New(t *testing.T) {
|
||||
tt.want.PublicId = id
|
||||
got.PublicId = id
|
||||
|
||||
conn.LogMode(true)
|
||||
conf := NewArgon2Configuration()
|
||||
require.NotNil(conf)
|
||||
conf.PrivateId, err = newArgon2ConfigurationId()
|
||||
require.NoError(err)
|
||||
conf.PasswordMethodId = got.PublicId
|
||||
got.PasswordConfId = conf.PrivateId
|
||||
|
||||
ctx := context.Background()
|
||||
_, err2 := w.DoTx(ctx, db.StdRetryCnt, db.ExpBackoff{},
|
||||
func(_ db.Reader, iw db.Writer) error {
|
||||
require.NoError(iw.Create(ctx, conf))
|
||||
return iw.Create(ctx, got)
|
||||
},
|
||||
)
|
||||
conn.LogMode(false)
|
||||
assert.NoError(err2)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user