ash_authentication/dev/dev_server/test_page.html.eex
James Harton 1c8f138c67
improvement!: Major redesign of DSL and code structure. (#35)
Highlights:

* Replaced `AshAuthentication.Provider` with the much more flexible `AshAuthentication.Strategy`.
* Moved strategies to within the `authentication` DSL using entities and removed excess extensions.
* Added a lot more documentation and test coverage.
2022-11-23 09:09:41 +13:00

55 lines
1.6 KiB
Elixir

<!DOCTYPE html>
<html lang="en">
<head>
<title>Ash Authentication</title>
<meta charset="utf-8">
</head>
<body>
<h1>Ash Authentication</h1>
<%= if Enum.any?(@resources) do %>
<h2>Resources:</h2>
<%= for {resource, options, strategies} <- @resources do %>
<h2><%= inspect(options.subject_name) %> - <%= Ash.Api.Info.short_name(options.api) %> / <%= Ash.Resource.Info.short_name(resource) %></h2>
<%= for strategy <- strategies do %>
<%= for phase <- Strategy.phases(strategy) do %>
<%= render_strategy(strategy, phase, options) %>
<% end %>
<% end %>
<% end %>
<h2>Validate token</h2>
<form method="post" action="/token_check">
<textarea name="token"></textarea>
<br />
<input type="submit" value="Check token" />
</form>
<% else %>
<p>
<strong>No resources configured</strong>
<br />
Please see <a href="https://hexdocs.pm/ash_authentication">the documentation</a> for more information.
</p>
<% end %>
<%= if Enum.any?(@current_users) do %>
<h2>Current users:</h2>
<a href="/clear_session">Clear session</a>
<table>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
<%= for {name, user} <- @current_users do %>
<tr>
<td><code><pre>@<%= name %></pre></code></td>
<td><code><pre><%= inspect user, pretty: true %></pre></code></td>
</tr>
<% end %>
</table>
<% end %>
</body>
</html>