www/pwmgr.js
/* Authenticate a user to Vault using a password.
A successful Vault response for a password login looks similar to:
{"request_id":"df406871-9c46-2a4b-265a-e4991e1b3737","lease_id":"","renewable":false,"lease_duration":0,"data":null,"wrap_info":null,"warnings":null,"auth":{"client_token":"7d44048a-60b0-6788-7252-1f81a423387e","accessor":"2cc26537-4873-75e5-c18d-5bc5e0d34434","policies":["default","user-psparks"],"metadata":{"userid":"psparks"},"lease_duration":2764800,"renewable":true,"entity_id":"0cf6ec07-3c81-ff05-64f2-d5a835091e92"}}
*/
Authenticate a user to Vault using a password.
Authenticate a user to Vault using a password .
function passwordAuthenticate(vaultid, password) {
    var xhttp = new XMLHttpRequest();
    xhttp.open("POST", BASEURL +"v1/auth/userpass/login/"+ vaultid, false);
    xhttp.setRequestHeader("Content-type", "application/json");
    xhttp.send('{"password":"'+ password +'"}');
    var response = JSON.parse(xhttp.responseText);
    if (! response.auth)
        return ""
    console.log("Response: token=%s", response.auth.client_token);
    return response.auth.client_token
}
function passwordAuthenticate ( vaultid , password ) { var xhttp = new XMLHttpRequest ( ) ; xhttp . open ( "POST" , BASEURL + "v1/auth/userpass/login/" + vaultid , false ) ; xhttp . setRequestHeader ( "Content-type" , "application/json" ) ; xhttp . send ( '{"password":"' + password + '"}' ) ; var response = JSON . parse ( xhttp . responseText ) ; if ( ! response . auth ) return "" console . log ( "Response: token=%s" , response . auth . client_token ) ; return response . auth . client_token }
Authenticate a user to Vault using a password.
Authenticate a user to Vault using a password .