add oauth2-provider templates to project
This commit is contained in:
parent
9a2d180bae
commit
99ef4287bd
11 changed files with 302 additions and 2 deletions
|
|
@ -79,8 +79,6 @@ OIDC_RSA_PRIVATE_KEY_FILE_PATH = config('OIDC_RSA_PRIVATE_KEY_FILE_PATH', defaul
|
|||
with open(OIDC_RSA_PRIVATE_KEY_FILE_PATH) as oidc_rsa_private_key_file:
|
||||
OIDC_RSA_PRIVATE_KEY = oidc_rsa_private_key_file.read()
|
||||
|
||||
print(OIDC_RSA_PRIVATE_KEY)
|
||||
|
||||
OAUTH2_PROVIDER = {
|
||||
# this is the list of available scopes
|
||||
'SCOPES_BACKEND_CLASS': 'apps.gooyal_oauth2.scopes.Scopes',
|
||||
|
|
|
|||
18
templates/oauth2_provider/application_confirm_delete.html
Normal file
18
templates/oauth2_provider/application_confirm_delete.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
<h3 class="block-center-heading">{% trans "Are you sure to delete the application" %} {{ application.name }}?</h3>
|
||||
<form method="post" action="{% url 'oauth2_provider:delete' application.pk %}">
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<a class="btn btn-large" href="{% url "oauth2_provider:list" %}">{% trans "Cancel" %}</a>
|
||||
<input type="submit" class="btn btn-large btn-danger" name="allow" value="{% trans 'Delete' %}"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
56
templates/oauth2_provider/application_detail.html
Normal file
56
templates/oauth2_provider/application_detail.html
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
<h3 class="block-center-heading">{{ application.name }}</h3>
|
||||
|
||||
<ul class="unstyled">
|
||||
<li>
|
||||
<p><b>{% trans "Client id" %}</b></p>
|
||||
<input class="input-block-level" type="text" value="{{ application.client_id }}" readonly>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Client secret" %}</b></p>
|
||||
<input class="input-block-level" type="text" value="{{ application.client_secret }}" readonly>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Hash client secret" %}</b></p>
|
||||
<p>{{ application.hash_client_secret|yesno:_("yes,no") }}</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Client type" %}</b></p>
|
||||
<p>{{ application.client_type }}</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Authorization Grant Type" %}</b></p>
|
||||
<p>{{ application.authorization_grant_type }}</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Redirect Uris" %}</b></p>
|
||||
<textarea class="input-block-level" readonly>{{ application.redirect_uris }}</textarea>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Post Logout Redirect Uris" %}</b></p>
|
||||
<textarea class="input-block-level" readonly>{{ application.post_logout_redirect_uris }}</textarea>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p><b>{% trans "Allowed Origins" %}</b></p>
|
||||
<textarea class="input-block-level" readonly>{{ application.allowed_origins }}</textarea>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="btn-toolbar">
|
||||
<a class="btn" href="{% url "oauth2_provider:list" %}">{% trans "Go Back" %}</a>
|
||||
<a class="btn btn-primary" href="{% url "oauth2_provider:update" application.pk %}">{% trans "Edit" %}</a>
|
||||
<a class="btn btn-danger" href="{% url "oauth2_provider:delete" application.pk %}">{% trans "Delete" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
42
templates/oauth2_provider/application_form.html
Normal file
42
templates/oauth2_provider/application_form.html
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
<form class="form-horizontal" method="post" action="{% block app-form-action-url %}{% url 'oauth2_provider:update' application.pk %}{% endblock app-form-action-url %}">
|
||||
<h3 class="block-center-heading">
|
||||
{% block app-form-title %}
|
||||
{% trans "Edit application" %} {{ application.name }}
|
||||
{% endblock app-form-title %}
|
||||
</h3>
|
||||
{% csrf_token %}
|
||||
|
||||
{% for field in form %}
|
||||
<div class="control-group {% if field.errors %}error{% endif %}">
|
||||
<label class="control-label" for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
<div class="controls">
|
||||
{{ field }}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="control-group {% if form.non_field_errors %}error{% endif %}">
|
||||
{% for error in form.non_field_errors %}
|
||||
<span class="help-inline">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<a class="btn" href="{% block app-form-back-url %}{% url "oauth2_provider:detail" application.pk %}{% endblock app-form-back-url %}">
|
||||
{% trans "Go Back" %}
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
20
templates/oauth2_provider/application_list.html
Normal file
20
templates/oauth2_provider/application_list.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
<h3 class="block-center-heading">{% trans "Your applications" %}</h3>
|
||||
{% if applications %}
|
||||
<ul>
|
||||
{% for application in applications %}
|
||||
<li><a href="{% url "oauth2_provider:detail" application.pk %}">{{ application.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<a class="btn btn-success" href="{% url "oauth2_provider:register" %}">{% trans "New Application" %}</a>
|
||||
{% else %}
|
||||
|
||||
<p>{% trans "No applications defined" %}. <a href="{% url 'oauth2_provider:register' %}">{% trans "Click here" %}</a> {% trans "if you want to register a new one" %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{% extends "oauth2_provider/application_form.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block app-form-title %}{% trans "Register a new application" %}{% endblock app-form-title %}
|
||||
|
||||
{% block app-form-action-url %}{% url 'oauth2_provider:register' %}{% endblock app-form-action-url %}
|
||||
|
||||
{% block app-form-back-url %}{% url "oauth2_provider:list" %}"{% endblock app-form-back-url %}
|
||||
40
templates/oauth2_provider/authorize.html
Normal file
40
templates/oauth2_provider/authorize.html
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
{% if not error %}
|
||||
<form id="authorizationForm" method="post">
|
||||
<h3 class="block-center-heading">{% trans "Authorize" %} {{ application.name }}?</h3>
|
||||
{% csrf_token %}
|
||||
|
||||
{% for field in form %}
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<p>{% trans "Application requires the following permissions" %}</p>
|
||||
<ul>
|
||||
{% for scope in scopes_descriptions %}
|
||||
<li>{{ scope }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{{ form.errors }}
|
||||
{{ form.non_field_errors }}
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<input type="submit" class="btn btn-large" value="{% trans 'Cancel' %}"/>
|
||||
<input type="submit" class="btn btn-large btn-primary" name="allow" value="{% trans 'Authorize' %}"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
<h2>Error: {{ error.error }}</h2>
|
||||
<p>{{ error.description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
9
templates/oauth2_provider/authorized-token-delete.html
Normal file
9
templates/oauth2_provider/authorized-token-delete.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
<p>{% trans "Are you sure you want to delete this token?" %}</p>
|
||||
<input type="submit" value="{% trans 'Delete' %}" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
23
templates/oauth2_provider/authorized-tokens.html
Normal file
23
templates/oauth2_provider/authorized-tokens.html
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
<h1>{% trans "Tokens" %}</h1>
|
||||
<ul>
|
||||
{% for authorized_token in authorized_tokens %}
|
||||
<li>
|
||||
{{ authorized_token.application }}
|
||||
(<a href="{% url 'oauth2_provider:authorized-token-delete' authorized_token.pk %}">{% trans "revoke" %}</a>)
|
||||
</li>
|
||||
<ul>
|
||||
{% for scope_name, scope_description in authorized_token.scopes.items %}
|
||||
<li>{{ scope_name }}: {{ scope_description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% empty %}
|
||||
<li>{% trans "There are no authorized tokens yet." %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
48
templates/oauth2_provider/base.html
Normal file
48
templates/oauth2_provider/base.html
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}{% endblock title %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
{% block css %}
|
||||
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
|
||||
{% endblock css %}
|
||||
|
||||
<style>
|
||||
body {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.block-center {
|
||||
max-width: 500px;
|
||||
padding: 19px 29px 29px;
|
||||
margin: 0 auto 20px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e5e5e5;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
|
||||
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.05);
|
||||
}
|
||||
.block-center .block-center-heading {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
37
templates/oauth2_provider/logout_confirm.html
Normal file
37
templates/oauth2_provider/logout_confirm.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{% extends "oauth2_provider/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
<div class="block-center">
|
||||
{% if not error %}
|
||||
<form id="authorizationForm" method="post">
|
||||
{% if application %}
|
||||
<h3 class="block-center-heading">Confirm Logout requested by {{ application.name }}</h3>
|
||||
{% else %}
|
||||
<h3 class="block-center-heading">Confirm Logout</h3>
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
|
||||
{% for field in form %}
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{{ form.errors }}
|
||||
{{ form.non_field_errors }}
|
||||
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<input type="submit" class="btn btn-large" value="Cancel"/>
|
||||
<input type="submit" class="btn btn-large btn-primary" name="allow" value="Logout"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
<h2>Error: {{ error.error }}</h2>
|
||||
<p>{{ error.description }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Reference in a new issue