2026-04-06 15:48:37 +05:30
|
|
|
// Copyright IBM Corp. 2020, 2026
|
2021-02-10 13:52:42 -05:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-02-02 17:15:17 -08:00
|
|
|
|
2020-07-07 07:44:49 -07:00
|
|
|
package authtoken
|
|
|
|
|
|
2021-01-07 10:02:32 -05:00
|
|
|
const (
|
2021-02-10 13:52:42 -05:00
|
|
|
// defaultAuthTokenTableName is the table where auth tokens are stored.
|
|
|
|
|
defaultAuthTokenTableName = "auth_token"
|
|
|
|
|
|
|
|
|
|
// defaultAuthTokenViewName is a view that includes all the auth_token
|
|
|
|
|
// columns plus the auth_account columns of: scope_id, iam_user_id and
|
|
|
|
|
// auth_method_id. These additional columns are returned via the API for
|
|
|
|
|
// auth tokens, so the view's handy
|
|
|
|
|
defaultAuthTokenViewName = "auth_token_account"
|
2021-01-07 10:02:32 -05:00
|
|
|
)
|
2020-07-17 16:20:56 -04:00
|
|
|
|
2020-07-07 07:44:49 -07:00
|
|
|
// TableName returns the table name for the auth token.
|
2024-01-04 12:51:21 -08:00
|
|
|
func (at *AuthToken) TableName() string {
|
|
|
|
|
if at.tableName != "" {
|
|
|
|
|
return at.tableName
|
2020-07-07 07:44:49 -07:00
|
|
|
}
|
2020-07-17 16:20:56 -04:00
|
|
|
return defaultAuthTokenTableName
|
2020-07-07 07:44:49 -07:00
|
|
|
}
|
|
|
|
|
|
2020-07-17 16:20:56 -04:00
|
|
|
// SetTableName sets the table name. If the caller attempts to
|
|
|
|
|
// set the name to "" the name will be reset to the default name.
|
2024-01-04 12:51:21 -08:00
|
|
|
func (at *AuthToken) SetTableName(n string) {
|
|
|
|
|
at.tableName = n
|
2020-07-07 07:44:49 -07:00
|
|
|
}
|
2020-07-23 09:53:37 -07:00
|
|
|
|
2021-02-10 13:52:42 -05:00
|
|
|
// TableName returns the table name for the authTokenView.
|
2024-01-04 12:51:21 -08:00
|
|
|
func (atv *authTokenView) TableName() string {
|
|
|
|
|
if atv.tableName != "" {
|
|
|
|
|
return atv.tableName
|
2020-07-23 09:53:37 -07:00
|
|
|
}
|
2021-02-10 13:52:42 -05:00
|
|
|
return defaultAuthTokenViewName
|
2020-07-23 09:53:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetTableName sets the table name. If the caller attempts to
|
|
|
|
|
// set the name to "" the name will be reset to the default name.
|
2024-01-04 12:51:21 -08:00
|
|
|
func (atv *authTokenView) SetTableName(n string) {
|
|
|
|
|
atv.tableName = n
|
2020-07-23 17:58:41 -04:00
|
|
|
}
|