Repository: hashicorp/vault
File: ui/app/models/auth-method.js (JavaScript)

Code before:
      type: 'containsWhiteSpace',
      message: WHITESPACE_WARNING('path'),
      level: 'warn',
    },
  ],
};

@withModelValidations(validations)
export default class AuthMethodModel extends Model {
  @service store;

  @belongsTo('mount-config', { async: false, inverse: null }) config; // one-to-none that replaces former fragment
  @hasMany('auth-config', { polymorphic: true, inverse: 'backend', async: false }) authConfigs;
  @attr('string') path;
  @attr('string') accessor;
  @attr('string') name;
  @attr('string') type;
  // namespaces introduced types with a `ns_` prefix for built-in engines
  // so we need to strip that to normalize the type
  get methodType() {
    return this.type.replace(/^ns_/, '');
  }
  get icon() {
    // methodType refers to the backend type (e.g., "aws", "azure") and is set on a getter.
    const authMethods = filterEnginesByMountType('auth', true).find(
      (backend) => backend.type === this.methodType
    );
    return authMethods?.glyph || 'users';
  }
  @attr('string', {
    editType: 'textarea',
  })
  description;
  @attr('boolean', {
    helpText:
      'When Replication is enabled, a local mount will not be replicated across clusters. This can only be specified at mount time.',
  })
  local;
  @attr('boolean', {
    helpText:
      'When enabled - if a seal supporting seal wrapping is specified in the configuration, all critical security parameters (CSPs) in this backend will be seal wrapped. (For KV mounts, all values will be seal wrapped.) This can only be specified at mount time.',
  })
  sealWrap;

  // used when the `auth` prefix is important,
  // currently only when setting perf mount filtering
  get apiPath() {
    return `auth/${this.path}`;
  }
  get localDisplay() {
    return this.local ? 'local' : 'replicated';

Review comment (security):


would it make more sense to use the `engines-display-data` helper here to get the icon? 
`import { enginesDisplayData }  from 'vault/helpers/engines-display-data';` 

```suggestion
    const authMethod = enginesDisplayData(this.methodType)
```

Code after:
      type: 'containsWhiteSpace',
      message: WHITESPACE_WARNING('path'),
      level: 'warn',
    },
  ],
};

@withModelValidations(validations)
export default class AuthMethodModel extends Model {
  @service store;

  @belongsTo('mount-config', { async: false, inverse: null }) config; // one-to-none that replaces former fragment
  @hasMany('auth-config', { polymorphic: true, inverse: 'backend', async: false }) authConfigs;
  @attr('string') path;
  @attr('string') accessor;
  @attr('string') name;
  @attr('string') type;
  // namespaces introduced types with a `ns_` prefix for built-in engines
  // so we need to strip that to normalize the type
  get methodType() {
    return this.type.replace(/^ns_/, '');
  }
  get icon() {
    // methodType refers to the backend type (e.g., "aws", "azure") and is set on a getter.
    const authMethods = engineDisplayData(this.methodType);
    return authMethods?.glyph || 'users';
  }
  @attr('string', {
    editType: 'textarea',
  })
  description;
  @attr('boolean', {
    helpText:
      'When Replication is enabled, a local mount will not be replicated across clusters. This can only be specified at mount time.',
  })
  local;
  @attr('boolean', {
    helpText:
      'When enabled - if a seal supporting seal wrapping is specified in the configuration, all critical security parameters (CSPs) in this backend will be seal wrapped. (For KV mounts, all values will be seal wrapped.) This can only be specified at mount time.',
  })
  sealWrap;

  // used when the `auth` prefix is important,
  // currently only when setting perf mount filtering
  get apiPath() {
    return `auth/${this.path}`;
  }
  get localDisplay() {
    return this.local ? 'local' : 'replicated';
  }