github.com/hernad/nomad@v1.6.112/ui/app/adapters/auth-method.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 // @ts-check 7 import { default as ApplicationAdapter, namespace } from './application'; 8 import { dasherize } from '@ember/string'; 9 import classic from 'ember-classic-decorator'; 10 11 @classic 12 export default class AuthMethodAdapter extends ApplicationAdapter { 13 namespace = `${namespace}/acl`; 14 15 /** 16 * @param {string} modelName 17 * @returns {string} 18 */ 19 urlForFindAll(modelName) { 20 return dasherize(this.buildURL(modelName)); 21 } 22 23 /** 24 * @typedef {Object} ACLOIDCAuthURLParams 25 * @property {string} AuthMethodName 26 * @property {string} RedirectUri 27 * @property {string} ClientNonce 28 * @property {Object[]} Meta // NOTE: unsure if array of objects or kv pairs 29 */ 30 31 /** 32 * @param {ACLOIDCAuthURLParams} params 33 * @returns 34 */ 35 getAuthURL({ AuthMethodName, RedirectUri, ClientNonce, Meta }) { 36 const url = `/${this.namespace}/oidc/auth-url`; 37 return this.ajax(url, 'POST', { 38 data: { 39 AuthMethodName, 40 RedirectUri, 41 ClientNonce, 42 Meta, 43 }, 44 }); 45 } 46 }