empty server
This commit is contained in:
parent
3f35318ca7
commit
e3bb5ebdcc
26
app.py
Normal file
26
app.py
Normal file
@ -0,0 +1,26 @@
|
||||
from flask import Flask, render_template
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'onelogindemopytoolkit'
|
||||
|
||||
@app.route("/", methods=['GET', 'POST'])
|
||||
def index():
|
||||
errors = []
|
||||
error_reason = None
|
||||
not_auth_warn = False
|
||||
success_slo = False
|
||||
attributes = False
|
||||
paint_logout = False
|
||||
return render_template(
|
||||
'index.html',
|
||||
errors=errors,
|
||||
error_reason=error_reason,
|
||||
not_auth_warn=not_auth_warn,
|
||||
success_slo=success_slo,
|
||||
attributes=attributes,
|
||||
paint_logout=paint_logout
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='127.0.0.1', port=5001, debug=True)
|
1
example.url
Normal file
1
example.url
Normal file
@ -0,0 +1 @@
|
||||
https://gist.github.com/thomasdarimont/6a3905778520b746ff009cf3a41643e9
|
@ -1 +1,2 @@
|
||||
authlib
|
||||
authlib
|
||||
flask
|
26
templates/base.html
Normal file
26
templates/base.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>A Python OIDC demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>A Python OIDC demo</h1>
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
54
templates/index.html
Normal file
54
templates/index.html
Normal file
@ -0,0 +1,54 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if errors %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<strong>Errors:</strong>
|
||||
<ul class="list-unstyled">
|
||||
{% for err in errors %}
|
||||
<li>{{err}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if error_reason %}
|
||||
<span>{{error_reason}}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not_auth_warn %}
|
||||
<div class="alert alert-danger" role="alert">Not authenticated</div>
|
||||
{% endif %}
|
||||
|
||||
{% if success_slo %}
|
||||
<div class="alert alert-success" role="alert">Successfully logged out</div>
|
||||
{% endif %}
|
||||
|
||||
{% if paint_logout %}
|
||||
{% if attributes %}
|
||||
<p>You have the following attributes:</p>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th>Name</th><th>Values</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for attr in attributes %}
|
||||
<tr><td>{{ attr.0 }}</td>
|
||||
<td><ul class="list-unstyled">
|
||||
{% for val in attr.1 %}
|
||||
<li>{{ val }}</li>
|
||||
{% endfor %}
|
||||
</ul></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="alert alert-danger" role="alert">You don't have any attributes</div>
|
||||
{% endif %}
|
||||
<a href="/logout" class="btn btn-danger">Logout</a>
|
||||
{% else %}
|
||||
<a href="/login" class="btn btn-primary">Login</a>
|
||||
{% endif %}
|
||||
<a href="/metadata" class="btn btn-info">Metadata</a>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user