From ab1fd3255b550909c5bd329165a3aa140a9804ff Mon Sep 17 00:00:00 2001
From: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
Date: Fri, 29 Oct 2021 13:00:34 -0700
Subject: [PATCH] UI/Remove token_type field from token auth method (#12904)
* chane form field to angle bracket syntax
* computes tuneAttrs depending on auth method type
* make all attrs linkable
* delete token_type for token auth methods before save
* adds changelog
* adds copy to unsupported auth methods
* adds doc link to copy
* adds test for linkable auth method list
---
changelog/12904.txt | 3 +
ui/app/components/auth-config-form/options.js | 6 +
.../supported-managed-auth-backends.js | 2 +-
ui/app/models/auth-method.js | 23 ++-
.../components/auth-config-form/options.hbs | 4 +-
.../vault/cluster/access/method/section.hbs | 9 +
.../vault/cluster/access/methods.hbs | 159 ++++++------------
.../settings/auth/configure/section.hbs | 2 +-
ui/tests/acceptance/auth-list-test.js | 43 ++++-
9 files changed, 126 insertions(+), 125 deletions(-)
create mode 100644 changelog/12904.txt
diff --git a/changelog/12904.txt b/changelog/12904.txt
new file mode 100644
index 000000000..e65636b6c
--- /dev/null
+++ b/changelog/12904.txt
@@ -0,0 +1,3 @@
+```release-note:bug
+ui: Removes ability to tune token_type for token auth methods
+```
\ No newline at end of file
diff --git a/ui/app/components/auth-config-form/options.js b/ui/app/components/auth-config-form/options.js
index 254d03ee0..9ce654e48 100644
--- a/ui/app/components/auth-config-form/options.js
+++ b/ui/app/components/auth-config-form/options.js
@@ -22,6 +22,12 @@ export default AuthConfigComponent.extend({
saveModel: task(function*() {
let data = this.model.config.serialize();
data.description = this.model.description;
+
+ // token_type should not be tuneable for the token auth method, default is 'default-service'
+ if (this.model.type === 'token') {
+ delete data.token_type;
+ }
+
try {
yield this.model.tune(data);
} catch (err) {
diff --git a/ui/app/helpers/supported-managed-auth-backends.js b/ui/app/helpers/supported-managed-auth-backends.js
index ee668c24b..695a6b2f5 100644
--- a/ui/app/helpers/supported-managed-auth-backends.js
+++ b/ui/app/helpers/supported-managed-auth-backends.js
@@ -1,6 +1,6 @@
import { helper as buildHelper } from '@ember/component/helper';
-const MANAGED_AUTH_BACKENDS = ['okta', 'radius', 'ldap', 'cert', 'userpass'];
+const MANAGED_AUTH_BACKENDS = ['cert', 'userpass', 'ldap', 'okta', 'radius'];
export function supportedManagedAuthBackends() {
return MANAGED_AUTH_BACKENDS;
diff --git a/ui/app/models/auth-method.js b/ui/app/models/auth-method.js
index dc1257610..2214a7595 100644
--- a/ui/app/models/auth-method.js
+++ b/ui/app/models/auth-method.js
@@ -49,14 +49,25 @@ let ModelExport = Model.extend(Validations, {
return this.local ? 'local' : 'replicated';
}),
- tuneAttrs: computed(function() {
- return expandAttributeMeta(this, [
- 'description',
- 'config.{listingVisibility,defaultLeaseTtl,maxLeaseTtl,tokenType,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
- ]);
+ tuneAttrs: computed('path', function() {
+ let { methodType } = this;
+ let tuneAttrs;
+ // token_type should not be tuneable for the token auth method
+ if (methodType === 'token') {
+ tuneAttrs = [
+ 'description',
+ 'config.{listingVisibility,defaultLeaseTtl,maxLeaseTtl,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
+ ];
+ } else {
+ tuneAttrs = [
+ 'description',
+ 'config.{listingVisibility,defaultLeaseTtl,maxLeaseTtl,tokenType,auditNonHmacRequestKeys,auditNonHmacResponseKeys,passthroughRequestHeaders}',
+ ];
+ }
+ return expandAttributeMeta(this, tuneAttrs);
}),
- //sys/mounts/auth/[auth-path]/tune.
+ // sys/mounts/auth/[auth-path]/tune.
tune: memberAction({
path: 'tune',
type: 'post',
diff --git a/ui/app/templates/components/auth-config-form/options.hbs b/ui/app/templates/components/auth-config-form/options.hbs
index c46d595cf..3b8b227c9 100644
--- a/ui/app/templates/components/auth-config-form/options.hbs
+++ b/ui/app/templates/components/auth-config-form/options.hbs
@@ -3,7 +3,7 @@
- {{method.accessor}}
-
-
+ {{method.accessor}}
+
- {{method.accessor}}
-
-