oidc example auth
This commit is contained in:
37
templates/base.html
Normal file
37
templates/base.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{% block title %}BoxDrop{% endblock %}</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; max-width: 800px; margin: 2rem auto; padding: 0 1rem; }
|
||||
nav { display: flex; justify-content: space-between; align-items: center;
|
||||
border-bottom: 1px solid #ddd; padding-bottom: 0.75rem; margin-bottom: 2rem; }
|
||||
a { color: #0066cc; text-decoration: none; }
|
||||
a:hover { text-decoration: underline; }
|
||||
.btn { display: inline-block; padding: 0.4rem 1rem; border-radius: 4px;
|
||||
background: #0066cc; color: #fff; }
|
||||
.btn:hover { background: #0052a3; text-decoration: none; }
|
||||
.btn-outline { background: transparent; border: 1px solid #0066cc; color: #0066cc; }
|
||||
.btn-outline:hover { background: #e8f0fe; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<strong><a href="{{ url_for('index') }}">BoxDrop</a></strong>
|
||||
<span>
|
||||
{% if user %}
|
||||
Signed in as <strong>{{ user.get('name') or user.get('email') }}</strong>
|
||||
|
||||
<a class="btn btn-outline" href="{{ url_for('logout') }}">Log out</a>
|
||||
{% else %}
|
||||
<a class="btn" href="{{ url_for('login') }}">Log in with Authentik</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</nav>
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
25
templates/dashboard.html
Normal file
25
templates/dashboard.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Dashboard – BoxDrop{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Dashboard</h1>
|
||||
<p>This page is only visible to authenticated users.</p>
|
||||
|
||||
<table style="border-collapse:collapse;width:100%">
|
||||
<thead>
|
||||
<tr style="background:#f4f4f4">
|
||||
<th style="text-align:left;padding:0.5rem 1rem;border:1px solid #ddd">Claim</th>
|
||||
<th style="text-align:left;padding:0.5rem 1rem;border:1px solid #ddd">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key, value in user.items() %}
|
||||
<tr>
|
||||
<td style="padding:0.5rem 1rem;border:1px solid #ddd"><code>{{ key }}</code></td>
|
||||
<td style="padding:0.5rem 1rem;border:1px solid #ddd">{{ value }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
20
templates/index.html
Normal file
20
templates/index.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Home – BoxDrop{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if user %}
|
||||
<h1>Welcome back, {{ user.get('name') or user.get('email') }}! 👋</h1>
|
||||
<p>You are authenticated via Authentik.</p>
|
||||
<p><a class="btn" href="{{ url_for('dashboard') }}">Go to Dashboard</a></p>
|
||||
|
||||
<details style="margin-top:2rem">
|
||||
<summary>Raw token claims</summary>
|
||||
<pre style="background:#f4f4f4;padding:1rem;border-radius:4px;overflow:auto">{{ user | tojson(indent=2) }}</pre>
|
||||
</details>
|
||||
{% else %}
|
||||
<h1>BoxDrop</h1>
|
||||
<p>Please log in to continue.</p>
|
||||
<p><a class="btn" href="{{ url_for('login') }}">Log in with Authentik</a></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user