Files
threshold/internal/auth/password/public_ids.go
T
Johan Brandhorst-Satzkorn 53481146fd feat(authmethods): add well typed attribute options (#1972)
Add well typed attribute options to the authmethods proto
definitions, while hiding them from being rendered in
the openapiv2 spec.
2022-04-20 13:32:31 -04:00

41 lines
1.0 KiB
Go

package password
import (
"github.com/hashicorp/boundary/internal/auth"
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/errors"
"github.com/hashicorp/boundary/internal/intglobals"
"github.com/hashicorp/boundary/internal/types/subtypes"
)
func init() {
if err := subtypes.Register(auth.Domain, Subtype, AuthMethodPrefix, intglobals.OldPasswordAccountPrefix, intglobals.NewPasswordAccountPrefix); err != nil {
panic(err)
}
}
// PublicId prefixes for the resources in the password package.
const (
AuthMethodPrefix = "ampw"
Subtype = subtypes.Subtype("password")
)
func newAuthMethodId() (string, error) {
const op = "password.newAuthMethodId"
id, err := db.NewPublicId(AuthMethodPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, op)
}
return id, nil
}
func newAccountId() (string, error) {
const op = "password.newAccountId"
id, err := db.NewPublicId(intglobals.NewPasswordAccountPrefix)
if err != nil {
return "", errors.WrapDeprecated(err, op)
}
return id, nil
}