mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	Call the invalid credential handler even with a delegated auth error handler (#24938)
- The specified delegated auth error handler should not have to worry about re-implementing the invalid credential handler logic. It should only worry about how to return/format the error back to the client.
This commit is contained in:
		| @@ -1920,6 +1920,11 @@ func (c *Core) handleDelegatedAuth(ctx context.Context, origReq *logical.Request | |||||||
| 	if err != nil || authResp.IsError() { | 	if err != nil || authResp.IsError() { | ||||||
| 		// see if the backend wishes to handle the failed auth | 		// see if the backend wishes to handle the failed auth | ||||||
| 		if da.AuthErrorHandler() != nil { | 		if da.AuthErrorHandler() != nil { | ||||||
|  | 			if err != nil && errors.Is(err, logical.ErrInvalidCredentials) { | ||||||
|  | 				// We purposefully ignore the error here as the handler will | ||||||
|  | 				// always return the original error we passed in. | ||||||
|  | 				_, _, _ = invalidCredHandler(err) | ||||||
|  | 			} | ||||||
| 			resp, err := da.AuthErrorHandler()(ctx, origReq, authReq, authResp, err) | 			resp, err := da.AuthErrorHandler()(ctx, origReq, authReq, authResp, err) | ||||||
| 			return resp, nil, err | 			return resp, nil, err | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Steven Clark
					Steven Clark