Initial commit
This commit is contained in:
commit
4be2036f3b
10 changed files with 1303 additions and 0 deletions
119
src/templates/index.html
Normal file
119
src/templates/index.html
Normal file
|
@ -0,0 +1,119 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>FastAPI OIDC test</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background-color: antiquewhite;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
.content {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.user-info {
|
||||
padding: 1em;
|
||||
margin: 1em 0;
|
||||
display: flex;
|
||||
gap: 0.5em;
|
||||
flex-direction: column;
|
||||
width: fit-content;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0px 0px 10px lightgreen;
|
||||
background-color: lightgreen;
|
||||
}
|
||||
.user-info * {
|
||||
flex: 2 1 auto;
|
||||
margin: 0;
|
||||
}
|
||||
.user-info .picture {
|
||||
max-width: 3em;
|
||||
max-height: 3em
|
||||
}
|
||||
.login-box {
|
||||
text-align: center;
|
||||
}
|
||||
.login-toolbox {
|
||||
max-width: 20em;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 1em;
|
||||
gap: 5px;
|
||||
}
|
||||
.login-toolbox a {
|
||||
background-color: lightblue;
|
||||
padding: 3px 6px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
color: black;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.login-toolbox .error {
|
||||
color: darkred;
|
||||
padding: 3px 6px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.login-toolbox a.logout:hover {
|
||||
background-color: orange;
|
||||
}
|
||||
.login-toolbox a:hover {
|
||||
background-color: lightgreen;
|
||||
}
|
||||
.debug {
|
||||
font-size: 90%;
|
||||
}
|
||||
.debug p, .debug .key {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test app for OIDC</h1>
|
||||
<div class="login-box">
|
||||
<div class="login-toolbox">
|
||||
{% if user %}
|
||||
<a href="logout" class="logout">Logout</a>
|
||||
{% else %}
|
||||
{% for provider in settings.oidc.providers %}
|
||||
<a href="login?provider={{ provider.name }}">Login with: {{ provider.name }}</a>
|
||||
{% else %}
|
||||
<span class="error">Cannot login: no oidc prodiver in settings.yaml</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<a href="private">Private area, accessible only when Authorization is set (logged in)</a>
|
||||
</div>
|
||||
<div class="content">
|
||||
{% if user %}
|
||||
<div class="user-info">
|
||||
<p>Hey, {{ user.name }}</p>
|
||||
{% if user.picture %}
|
||||
<img src="{{ user.picture }}" class="picture"></img>
|
||||
{% endif %}
|
||||
<p>{{ user.email }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if user and settings.oidc.show_session_details %}
|
||||
<div class="debug">
|
||||
<p>Session details:</p>
|
||||
<ul>
|
||||
{% for key, value in auth_data.items() %}
|
||||
<li>
|
||||
<span class="key">{{ key }}</span>: {{ value }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue