github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/adapters/auth-method.js (about)

     1  // @ts-check
     2  import { default as ApplicationAdapter, namespace } from './application';
     3  import { dasherize } from '@ember/string';
     4  import classic from 'ember-classic-decorator';
     5  
     6  @classic
     7  export default class AuthMethodAdapter extends ApplicationAdapter {
     8    namespace = `${namespace}/acl`;
     9  
    10    /**
    11     * @param {string} modelName
    12     * @returns {string}
    13     */
    14    urlForFindAll(modelName) {
    15      return dasherize(this.buildURL(modelName));
    16    }
    17  
    18    /**
    19     * @typedef {Object} ACLOIDCAuthURLParams
    20     * @property {string} AuthMethod
    21     * @property {string} RedirectUri
    22     * @property {string} ClientNonce
    23     * @property {Object[]} Meta // NOTE: unsure if array of objects or kv pairs
    24     */
    25  
    26    /**
    27     * @param {ACLOIDCAuthURLParams} params
    28     * @returns
    29     */
    30    getAuthURL({ AuthMethod, RedirectUri, ClientNonce, Meta }) {
    31      const url = `/${this.namespace}/oidc/auth-url`;
    32      return this.ajax(url, 'POST', {
    33        data: {
    34          AuthMethod,
    35          RedirectUri,
    36          ClientNonce,
    37          Meta,
    38        },
    39      });
    40    }
    41  }