mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-24 16:11:08 +02:00
* updates api client vars to snake_case for custom messages * updates api client vars to snake_case for tools * updates api client vars to snake_case for sync * updates api client vars to snake_case for secrets engine * updates api client vars to snake_case for auth * updates api client vars to snake_case for usage * updates api client dep to point to gh repo * fixes custom-messages service unit tests * fixes configure-ssh test * fixes configure-ssh test...again
34 lines
914 B
TypeScript
34 lines
914 B
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import AuthBase from './base';
|
|
|
|
import type { UsernameLoginResponse } from 'vault/vault/auth/methods';
|
|
|
|
/**
|
|
* @module Auth::Form::Userpass
|
|
* see Auth::Base
|
|
* */
|
|
|
|
export default class AuthFormUserpass extends AuthBase {
|
|
loginFields = [{ name: 'username' }, { name: 'password' }];
|
|
|
|
async loginRequest(formData: { path: string; username: string; password: string }) {
|
|
const { path, username, password } = formData;
|
|
|
|
const { auth } = (await this.api.auth.userpassLogin(username, path, {
|
|
password,
|
|
})) as UsernameLoginResponse;
|
|
|
|
// normalize auth data so stored token data has the same keys regardless of auth type
|
|
return this.normalizeAuthResponse(auth, {
|
|
authMountPath: path,
|
|
displayName: auth?.metadata?.username,
|
|
token: auth.client_token,
|
|
ttl: auth.lease_duration,
|
|
});
|
|
}
|
|
}
|