github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/templates/settings/tokens.hbs (about)

     1  {{page-title "Tokens"}}
     2  <section class="section">
     3    <h1 class="title">Access Control Tokens</h1>
     4    <div class="columns">
     5      <div class="column is-two-thirds">
     6        <p class="message">Clusters that use Access Control Lists require tokens to perform certain tasks. By providing a token <strong>Secret ID</strong>, each future request will be authenticated, potentially authorizing read access to additional information. By providing a token <strong>Accessor ID</strong>, the policies and rules for the token will be listed.</p>
     7  
     8        <div class="notification is-info">
     9          <div class="columns">
    10            <div class="column">
    11              <h3 class="title is-4">Token Storage</h3>
    12              <p>Tokens are stored client-side in <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage">local storage</a>. This will persist your token across sessions. You can manually clear your token here.</p>
    13            </div>
    14            <div class="column is-centered is-minimum">
    15              <button data-test-token-clear class="button is-info" {{action "clearTokenProperties"}} type="button">Clear Token</button>
    16            </div>
    17          </div>
    18        </div>
    19  
    20        {{#unless this.tokenIsValid}}
    21          <div class="field">
    22            <label class="label" for="token-input">Secret ID</label>
    23            <div class="control">
    24              <input
    25                id="token-input"
    26                class="input"
    27                type="text"
    28                placeholder="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    29                {{!-- FIXME this placeholder gets read out by VoiceOver sans dashes 😵 --}}
    30                value={{this.token.secret}}
    31                oninput={{action (mut this.secret) value="target.value"}}
    32                data-test-token-secret>
    33            </div>
    34            <p class="help">Sent with every request to determine authorization</p>
    35          </div>
    36  
    37          <p class="content"><button data-test-token-submit class="button is-primary" {{action "verifyToken"}} type="button">Set Token</button></p>
    38        {{/unless}}
    39  
    40        {{#if this.tokenIsValid}}
    41          <div data-test-token-success class="notification is-success">
    42            <div class="columns">
    43              <div class="column">
    44                <h3 class="title is-4">Token Authenticated!</h3>
    45                <p>Your token is valid and authorized for the following policies.</p>
    46              </div>
    47            </div>
    48          </div>
    49        {{/if}}
    50  
    51        {{#if this.tokenIsInvalid}}
    52          <div data-test-token-error class="notification is-danger">
    53            <div class="columns">
    54              <div class="column">
    55                <h3 class="title is-4">Token Failed to Authenticate</h3>
    56                <p>The token secret you have provided does not match an existing token.</p>
    57              </div>
    58            </div>
    59          </div>
    60        {{/if}}
    61  
    62        {{#if this.tokenRecord}}
    63          <h3 class="title is-4">Token: {{this.tokenRecord.name}}</h3>
    64          <div class="content">
    65            <div>AccessorID: <code>{{this.tokenRecord.accessor}}</code></div>
    66            <div>SecretID: <code>{{this.tokenRecord.secret}}</code></div>
    67          </div>
    68          <h3 class="title is-4">Policies</h3>
    69          {{#if (eq this.tokenRecord.type "management")}}
    70            <div data-test-token-management-message class="boxed-section">
    71              <div class="boxed-section-body has-centered-text">
    72                The management token has all permissions
    73              </div>
    74            </div>
    75          {{else}}
    76            {{#each this.tokenRecord.policies as |policy|}}
    77              <div data-test-token-policy class="boxed-section">
    78                <div data-test-policy-name class="boxed-section-head">
    79                  {{policy.name}}
    80                </div>
    81                <div class="boxed-section-body">
    82                  <p data-test-policy-description class="content">
    83                    {{#if policy.description}}
    84                      {{policy.description}}
    85                    {{else}}
    86                      <em>No description</em>
    87                    {{/if}}
    88                  </p>
    89                  <pre><code data-test-policy-rules>{{policy.rules}}</code></pre>
    90                </div>
    91              </div>
    92            {{/each}}
    93          {{/if}}
    94        {{/if}}
    95      </div>
    96    </div>
    97  </section>
    98