Files
threshold/internal/auth/password/public_ids.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.3 KiB
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
2023-02-02 17:15:17 -08:00
// SPDX-License-Identifier: BUSL-1.1
package password
import (
"context"
"github.com/hashicorp/boundary/globals"
"github.com/hashicorp/boundary/internal/auth"
2020-08-10 17:15:02 -04:00
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/errors"
"github.com/hashicorp/boundary/internal/types/resource"
)
func init() {
globals.RegisterPrefixToResourceInfo(globals.PasswordAuthMethodPrefix, resource.AuthMethod, auth.Domain, Subtype)
globals.RegisterPrefixToResourceInfo(globals.PasswordAccountPreviousPrefix, resource.Account, auth.Domain, Subtype)
globals.RegisterPrefixToResourceInfo(globals.PasswordAccountPrefix, resource.Account, auth.Domain, Subtype)
}
2023-11-02 16:03:47 -04:00
// PublicId prefixes for the resources in the password package.
const (
Subtype = globals.Subtype("password")
2023-11-02 16:03:47 -04:00
)
func newAuthMethodId(ctx context.Context) (string, error) {
const op = "password.newAuthMethodId"
id, err := db.NewPublicId(ctx, globals.PasswordAuthMethodPrefix)
if err != nil {
return "", errors.Wrap(ctx, err, op)
}
2021-03-05 06:34:06 -08:00
return id, nil
}
func newAccountId(ctx context.Context) (string, error) {
const op = "password.newAccountId"
id, err := db.NewPublicId(ctx, globals.PasswordAccountPrefix)
if err != nil {
return "", errors.Wrap(ctx, err, op)
}
2021-03-05 06:34:06 -08:00
return id, nil
}