Files
threshold/internal/auth/password/register.go
T
Michael MiltonandMichael Gaffney 8d50a0913f Auth Method list pagination (#4165)
* wip

* implement list pagination for auth methods

* remove unused code

* update tests to fix sorting

* address PR comments

* simplify query, add token tests

* change test name

* wip sql testing

* add boolean column to indicate whether auth methods should be returned to unauthenticated users, remove secrets from api response

* is_active_public not null

* remove secrets and unwrapping

* move not null to immediately after data migration

* order public_id descending

* fix(db): Fix auth method migrations (#4193)

* wip

* fix db tests

* fix failing api tests

* reverse order of create time and update time in test

---------

Co-authored-by: Michael Gaffney <mike@gaffney.cc>
2024-01-05 07:43:21 -08:00

35 lines
923 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package password
import (
"context"
"github.com/hashicorp/boundary/internal/auth"
)
func init() {
auth.RegisterAuthMethodSubtype("password", &authMethodHooks{})
}
type authMethodHooks struct{}
// NewAuthMethod creates a new static auth method from the result
func (authMethodHooks) NewAuthMethod(ctx context.Context, result *auth.AuthMethodListQueryResult) (auth.AuthMethod, error) {
am := allocAuthMethod()
am.PublicId = result.PublicId
am.ScopeId = result.ScopeId
am.IsPrimaryAuthMethod = result.IsPrimaryAuthMethod
am.CreateTime = result.CreateTime
am.UpdateTime = result.UpdateTime
am.Name = result.Name
am.Description = result.Description
am.Version = result.Version
am.PasswordConfId = result.PasswordConfId
am.MinLoginNameLength = result.MinLoginNameLength
am.MinPasswordLength = result.MinPasswordLength
return &am, nil
}