oidc-fastapi-test/src/templates/home.html

67 lines
2.1 KiB
HTML
Raw Normal View History

2025-01-09 23:41:32 +01:00
{% extends "base.html" %}
{% block content %}
{% if not user %}
<div class="login-box">
<p>Log in with one of these authentication providers:</p>
<div class="login-toolbox">
{% for provider in settings.oidc.providers %}
2025-01-10 00:09:12 +01:00
<a href="login/{{ provider.id }}">{{ provider.name }}</a>
2025-01-09 23:41:32 +01:00
{% else %}
<span class="error">There is no authentication provider defined.
Hint: check the settings.yaml file.</span>
{% endfor %}
</div>
</div>
{% endif %}
{% if user %}
<div class="user-info">
<p>Hey, {{ user.name }}</p>
{% if user.picture %}
<img src="{{ user.picture }}" class="picture"></img>
{% endif %}
<div>{{ user.email }}</div>
{% if user.roles %}
<div>
<span>Roles:</span>
{% for role in user.roles %}
<span class="role">{{ role.name }}</span>
{% endfor %}
</div>
{% endif %}
<div>
<span>Provider:</span>
{{ user.oidc_provider.name }}
</div>
<a href="logout" class="logout">Logout</a>
</div>
{% endif %}
<div class="content">
<p>
These links should get different response codes depending on the authorization:
</p>
<div id="links-to-check">
<a href="public">Public</a>
<a href="protected">Auth protected content</a>
<a href="protected-by-foorole">Auth + foorole protected content</a>
<a href="protected-by-foorole-or-barrole">Auth + foorole or barrole protected content</a>
<a href="protected-by-barrole">Auth + barrole protected content</a>
<a href="protected-by-foorole-and-barrole">Auth + foorole and barrole protected content</a>
<a href="fast_api_depends">Using FastAPI Depends</a>
<a href="other">Other</a>
</div>
{% if user_info_details %}
<div class="debug-auth">
<p>User info</p>
<ul>
{% for key, value in user_info_details.items() %}
<li>
<span class="key">{{ key }}</span>: {{ value }}
</li>
{% endfor %}
</ul>
</div>
<div>Now is: {{ now }}</div>
</div>
{% endif %}
{% endblock %}