This commit is contained in:
phil 2025-01-10 19:03:09 +01:00
parent 41cf615052
commit c7478aff5f
4 changed files with 35 additions and 21 deletions

View file

@ -143,7 +143,7 @@ async def non_compliant_logout(
return templates.TemplateResponse( return templates.TemplateResponse(
name="non_compliant_logout.html", name="non_compliant_logout.html",
request=request, request=request,
context={"provider": provider}, context={"provider": provider, "home_url": request.url_for("home")},
) )

View file

@ -12,6 +12,9 @@
.hidden { .hidden {
display: none; display: none;
} }
.center {
text-align: center;
}
.content { .content {
width: 100%; width: 100%;
display: flex; display: flex;
@ -56,16 +59,20 @@
margin: 0; margin: 0;
} }
.login-toolbox { .login-toolbox {
max-width: 20em; max-width: 18em;
margin: auto; margin: 0.5em auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 0 1em; justify-content: center;
gap: 5px; padding: 0.8em;
background-color: floralwhite;
gap: 0.5em;
} }
.login-toolbox a { .login-toolbox a {
background-color: lightblue; background-color: lightblue;
padding: 3px 6px; font-weight: bold;
border-radius: 8px;
padding: 6px;
text-decoration: none; text-decoration: none;
text-align: center; text-align: center;
color: black; color: black;
@ -78,9 +85,6 @@
font-weight: bold; font-weight: bold;
flex: 1 1 auto; flex: 1 1 auto;
} }
.login-toolbox a:hover {
background-color: lightgreen;
}
.debug-auth { .debug-auth {
font-size: 90%; font-size: 90%;
background-color: #d8bebc75; background-color: #d8bebc75;
@ -106,12 +110,15 @@
.content #links-to-check { .content #links-to-check {
display: flex; display: flex;
text-align: center; text-align: center;
justify-content: center;
gap: 0.5em;
flex-flow: wrap;
} }
.content #links-to-check a { .content #links-to-check a {
margin: 5px;
color: black; color: black;
padding: 3px 6px; padding: 5px 10px;
text-decoration: none; text-decoration: none;
border-radius: 8px;
} }
.hasResponseStatus { .hasResponseStatus {
background-color: #88888840; background-color: #88888840;

View file

@ -1,15 +1,19 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<p class="center">
Test the authentication and authorization of FastAPI web based applications
with OpenID Connect and OAuth2 with different providers.
</p>
{% if not user %} {% if not user %}
<div class="login-box"> <div class="login-box">
<p>Log in with one of these authentication providers:</p>
<div class="login-toolbox"> <div class="login-toolbox">
{% for provider in settings.oidc.providers %} <p>Log in with one of these authentication providers:</p>
<a href="login/{{ provider.id }}">{{ provider.name }}</a> {% for provider in settings.oidc.providers %}
{% else %} <a href="login/{{ provider.id }}">{{ provider.name }}</a>
<span class="error">There is no authentication provider defined. {% else %}
Hint: check the settings.yaml file.</span> <span class="error">There is no authentication provider defined.
{% endfor %} Hint: check the settings.yaml file.</span>
{% endfor %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -35,6 +39,7 @@
<a href="logout" class="logout">Logout</a> <a href="logout" class="logout">Logout</a>
</div> </div>
{% endif %} {% endif %}
<hr>
<div class="content"> <div class="content">
<p> <p>
These links should get different response codes depending on the authorization: These links should get different response codes depending on the authorization:

View file

@ -6,10 +6,12 @@
authorisation to log in again without asking for credentials. authorisation to log in again without asking for credentials.
</p> </p>
<p> <p>
This is because {{ provider.name }} does not provide "end_session_endpoint" This is because {{ provider.name }} does not provide "end_session_endpoint" in its metadata
in its metadata (see: <a href="{{ provider._server_metadata_url }}">{{ provider._server_metadata_url }}</a>). (see: <a href="{{ provider._server_metadata_url }}">{{ provider._server_metadata_url }}</a>).
</p> </p>
<p> <p>
Please <a href="{{ provider.server_metadata['issuer'] }}">go there</a> and log out manually. You can just also go back to the <a href="{{ home_url }}">application home page</a>, but
it recommended to go to the <a href="{{ provider.server_metadata['issuer'] }}">provider's site</a>
and log out explicitely from there.
</p> </p>
{% endblock %} {% endblock %}