Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix aspects of
auth/token/create
request parsing (#18556)
* Fix aspects of `auth/token/create` request parsing Fixes #18550 Currently, the `auth/token/create` family of APIs (`create`, `create-orphan`, `create/{role}`) does non-standard parsing of requests, by directly using `mapstructure.WeakDecode(request.Data, ...)` instead of using the standard `framework.FieldData` abstraction. Furthermore, the fields declared for these APIs are incorrect, leading to inappropriate OpenAPI generation, and inappropriate warnings about ignored parameters. Detailed changes: * Factor out triplicated definitions of common fields across these three APIs. * Remove incorrect `role_name` field from `create-orphan`. * Add missing `lease` deprecated field. * Rename incorrectly named `metadata` field to `meta`, and change from `TypeMap` to `TypeKVPairs` to reflect actual underlying Go type is `map[string]string`. * Remove entirely incorrect `format` field. * Add declarative `Default: true` to `renewable` field, to match behaviour currently implemented in code. * Having fixed the field definitions to match current usage, remove the secondary decoding of the request via `mapstructure` inside `handleCreateCommon`, and migrate to using `FieldData` APIs like a normal operation function. * Add changelog * Rephrase comment.
- Loading branch information