Files
threshold/internal/auth/password/public_ids.go
T
Michael Gaffney 7897c1cf52 Add base resources for password authentication (#213)
* Add base SQL and protobuf files

* Add options and public Ids

* Add AuthMethod and Account resources

* Add repository

* Add CreateAuthMethod to repository

* Add CreateAccount method to repository

* Remove redundant foreign keys

* Document relationships between iam and auth tables

* Document relationships between auth and auth_password tables

* Add documentation for subtype triggers

* Use wt_scope_id domain type for scope_id

* Refactor: move test helper function

* Remove check from SetTableName

* Remove check from another SetTableName

* Use org scope in tests

* Remove handling of CreateTime and UpdateTime from docs
2020-07-24 10:23:35 -04:00

30 lines
581 B
Go

package password
import (
"fmt"
"github.com/hashicorp/watchtower/internal/db"
)
// PublicId prefixes for the resources in the password package.
const (
AuthMethodPrefix = "paum"
AccountPrefix = "pacc"
)
func newAuthMethodId() (string, error) {
id, err := db.NewPublicId(AuthMethodPrefix)
if err != nil {
return "", fmt.Errorf("new password auth method id: %w", err)
}
return id, err
}
func newAccountId() (string, error) {
id, err := db.NewPublicId(AccountPrefix)
if err != nil {
return "", fmt.Errorf("new password account id: %w", err)
}
return id, err
}