Add well typed attribute options to the authmethods proto definitions, while hiding them from being rendered in the openapiv2 spec.
41 lines
1.0 KiB
Go
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
|
|
}
|