2019-07-17 20:02:58 +00:00
{{ title "Tokens" }}
2017-09-19 14:47:10 +00:00
<section class="section">
<h1 class="title">Access Control Tokens</h1>
<div class="columns">
<div class="column is-two-thirds">
<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>
<div class="notification is-info">
<div class="columns">
<div class="column">
<h3 class="title is-4">Token Storage</h3>
2018-08-28 17:05:36 +00:00
<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>
2017-09-19 14:47:10 +00:00
</div>
<div class="column is-centered is-minimum">
2020-07-10 03:34:44 +00:00
<button data-test-token-clear class="button is-info" {{ action "clearTokenProperties" }} type="button">Clear Token</button>
2017-09-19 14:47:10 +00:00
</div>
</div>
</div>
2020-07-09 20:19:07 +00:00
{{ # unless this .tokenIsValid }}
2017-10-13 22:18:05 +00:00
<div class="field">
2020-07-28 17:59:14 +00:00
<label class="label" for="token-input">Secret ID</label>
2017-10-13 22:18:05 +00:00
<div class="control">
2018-01-05 20:59:36 +00:00
<input
2020-07-28 17:59:14 +00:00
id="token-input"
2018-01-05 20:59:36 +00:00
class="input"
type="text"
placeholder="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
2020-07-28 17:59:14 +00:00
{{!-- FIXME this placeholder gets read out by VoiceOver sans dashes 😵 --}}
2020-07-09 20:19:07 +00:00
value= {{ this .token .secret }}
oninput= {{ action ( mut this .secret ) value = "target.value" }}
2018-01-05 20:59:36 +00:00
data-test-token-secret>
2017-10-13 22:18:05 +00:00
</div>
<p class="help">Sent with every request to determine authorization</p>
2017-09-19 14:47:10 +00:00
</div>
2020-07-09 17:30:11 +00:00
<p class="content"><button data-test-token-submit class="button is-primary" {{ action "verifyToken" }} type="button">Set Token</button></p>
{{ / unless }}
2017-10-13 22:18:05 +00:00
2020-07-09 20:19:07 +00:00
{{ # if this .tokenIsValid }}
2018-01-05 20:59:36 +00:00
<div data-test-token-success class="notification is-success">
2017-10-13 22:18:05 +00:00
<div class="columns">
<div class="column">
<h3 class="title is-4">Token Authenticated!</h3>
<p>Your token is valid and authorized for the following policies.</p>
</div>
</div>
</div>
{{ / if }}
2020-07-09 20:19:07 +00:00
{{ # if this .tokenIsInvalid }}
2018-01-05 20:59:36 +00:00
<div data-test-token-error class="notification is-danger">
2017-10-13 22:18:05 +00:00
<div class="columns">
<div class="column">
<h3 class="title is-4">Token Failed to Authenticate</h3>
2017-10-14 19:42:14 +00:00
<p>The token secret you have provided does not match an existing token.</p>
2017-10-13 22:18:05 +00:00
</div>
</div>
</div>
{{ / if }}
2020-07-09 20:19:07 +00:00
{{ # if this .tokenRecord }}
<h3 class="title is-4">Token: {{ this .tokenRecord .name }} </h3>
2017-10-13 22:18:05 +00:00
<div class="content">
2020-07-09 20:19:07 +00:00
<div>AccessorID: <code> {{ this .tokenRecord .accessor }} </code></div>
<div>SecretID: <code> {{ this .tokenRecord .secret }} </code></div>
2017-10-13 22:18:05 +00:00
</div>
<h3 class="title is-4">Policies</h3>
2020-07-09 20:19:07 +00:00
{{ # if ( eq this .tokenRecord .type "management" ) }}
2018-01-05 20:59:36 +00:00
<div data-test-token-management-message class="boxed-section">
2017-10-13 22:18:05 +00:00
<div class="boxed-section-body has-centered-text">
The management token has all permissions
</div>
</div>
{{ else }}
2020-07-09 20:19:07 +00:00
{{ # each this .tokenRecord .policies as | policy | }}
2018-01-05 20:59:36 +00:00
<div data-test-token-policy class="boxed-section">
<div data-test-policy-name class="boxed-section-head">
2017-10-13 22:18:05 +00:00
{{ policy .name }}
</div>
<div class="boxed-section-body">
2018-01-05 20:59:36 +00:00
<p data-test-policy-description class="content">
2017-10-13 22:18:05 +00:00
{{ # if policy .description }}
{{ policy .description }}
{{ else }}
<em>No description</em>
{{ / if }}
</p>
2018-01-05 20:59:36 +00:00
<pre><code data-test-policy-rules> {{ policy .rules }} </code></pre>
2017-10-13 22:18:05 +00:00
</div>
</div>
{{ / each }}
{{ / if }}
{{ / if }}
2017-09-19 14:47:10 +00:00
</div>
</div>
</section>