mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
Add comments to existence functions
This commit is contained in:
@@ -37,9 +37,6 @@ func pathLogin(b *backend) *framework.Path {
|
|||||||
func (b *backend) pathLogin(
|
func (b *backend) pathLogin(
|
||||||
req *logical.Request, d *framework.FieldData) (*logical.Response, error) {
|
req *logical.Request, d *framework.FieldData) (*logical.Response, error) {
|
||||||
username := strings.ToLower(d.Get("username").(string))
|
username := strings.ToLower(d.Get("username").(string))
|
||||||
if username == "" {
|
|
||||||
return nil, fmt.Errorf("missing username")
|
|
||||||
}
|
|
||||||
|
|
||||||
password := d.Get("password").(string)
|
password := d.Get("password").(string)
|
||||||
if password == "" {
|
if password == "" {
|
||||||
@@ -52,7 +49,7 @@ func (b *backend) pathLogin(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return logical.ErrorResponse("unknown username or password"), nil
|
return logical.ErrorResponse("username does not exist"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a password match. Check for a hash collision for Vault 0.2+,
|
// Check for a password match. Check for a hash collision for Vault 0.2+,
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ func pathUserPassword(b *backend) *framework.Path {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// By always returning true, this endpoint will be enforced to be invoked only upon UpdateOperation.
|
||||||
|
// The existence of user will be checked in the operation handler.
|
||||||
func (b *backend) userPasswordExistenceCheck(req *logical.Request, data *framework.FieldData) (bool, error) {
|
func (b *backend) userPasswordExistenceCheck(req *logical.Request, data *framework.FieldData) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ func pathUserPolicies(b *backend) *framework.Path {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// By always returning true, this endpoint will be enforced to be invoked only upon UpdateOperation.
|
||||||
|
// The existence of user will be checked in the operation handler.
|
||||||
func (b *backend) userPoliciesExistenceCheck(req *logical.Request, data *framework.FieldData) (bool, error) {
|
func (b *backend) userPoliciesExistenceCheck(req *logical.Request, data *framework.FieldData) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ func (b *backend) userCreateUpdate(req *logical.Request, d *framework.FieldData)
|
|||||||
userEntry = &UserEntry{}
|
userEntry = &UserEntry{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// "password" will always be set here
|
|
||||||
if _, ok := d.GetOk("password"); ok {
|
if _, ok := d.GetOk("password"); ok {
|
||||||
err = b.updateUserPassword(req, d, userEntry)
|
err = b.updateUserPassword(req, d, userEntry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user