consul/ui/packages/consul-ui/app/components/auth-dialog
hashicorp-copywrite[bot] 5fb9df1640
[COMPLIANCE] License changes (#18443)
* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-11 09:12:13 -04:00
..
README.mdx ui: Upgrade AuthDialog (#11913) 2022-01-07 19:08:25 +00:00
chart.xstate.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
index.hbs [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00
index.js [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00

README.mdx

# AuthDialog

A component to help orchestrate a login/logout flow.

```hbs preview-template
<AuthDialog
  @src={{uri 'settings://consul:token'}}
  @sink={{uri 'settings://consul:token'}}
  @onchange={{action (noop)}}
>
  <:unauthorized as |api|>
    <AuthForm
      @onsubmit={{action api.login value="data"}}
    />
  </:unauthorized>
  <:authorized as |api|>
    <AuthProfile
      @item={{api.token}}
    />
    <button
      {{on 'click' (fn api.logout)}}
    >
      Logout
    </button>
  </:authorized>
</AuthDialog>
```

## Arguments

| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `onchange` | `Function` | | An action to fire when the users token has changed (logged in/logged out/token changed) |
| `src` | `URI` | | DataSource URI used to retrive/watch for changes on the users token |
| `sink` | `URI` | | DataSink URI used to save the users token to |

## Exports

| Name | Type | Description |
| --- | --- | --- |
| `login` | `Function` | Login with a specified token |
| `logout` | `Function` | Logout (delete token) |
| `token` | `Token` | The current token itself |

## Slots

| Name  | Description |
| --- | --- |
| `unauthorized` | This slot is only rendered when the user doesn't have a token |
| `authorized`   | This slot is only rendered when the user has a token.|

## See

- [Component Source Code](./index.js)
- [Template Source Code](./index.hbs)

---