add some app token stuff
This commit is contained in:
parent
4105974fe0
commit
9387c44cd1
60
lenticular_cloud/template/frontend/app_token.html.j2
Normal file
60
lenticular_cloud/template/frontend/app_token.html.j2
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{% extends 'frontend/base.html.j2' %}
|
||||||
|
|
||||||
|
{% block title %}{{ gettext('client certs') }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||||
|
{% for service in services.values() %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link{{' active' if loop.first else ''}}" id="home-tab" data-toggle="tab" href="#{{ service.name }}" role="tab" aria-controls="home" aria-selected="true">{{ service.name }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content" id="myTabContent">
|
||||||
|
{% for service in services.values() if service.client_cert %}
|
||||||
|
|
||||||
|
<div class="tab-pane fade{{ ' show active' if loop.first else '' }}" id="{{ service.name }}" role="tabpanel" aria-labelledby="{{ service.name }}-tab">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>not valid before</th>
|
||||||
|
<th>not valid after</th>
|
||||||
|
<th>serial_number<th>
|
||||||
|
<th> <th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for cert in client_certs[service.name] %}
|
||||||
|
<tr {{ 'class="table-warning"' if not cert.is_valid else ''}}>
|
||||||
|
<td>{{ cert.not_valid_before }}</td>
|
||||||
|
<td>{{ cert.not_valid_after }}</td>
|
||||||
|
<td>{{ cert.serial_number_hex }}</td>
|
||||||
|
<td>
|
||||||
|
<a title="{{ gettext('Download') }}" href="{{ url_for('.get_client_cert', service_name=service.name, serial_number=cert.serial_number_hex) }}"><i class="fas fa-file-download"></i></a>
|
||||||
|
|
||||||
|
{% if cert.is_valid %}
|
||||||
|
<a title="{{ gettext('Revoke')}}" href="{{ url_for('.revoke_client_cert', service_name=service.name, serial_number=cert.serial_number_hex) }}" onclick="client_cert.revoke_certificate(this.href, '{{ cert.serial_number_hex }}'); return false;"><i class="fas fa-ban"></i></a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<a class="btn btn-primary" href="{{ url_for('frontend.client_cert_new', service_name=service.name) }}">
|
||||||
|
New Certificate
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block script_js %}
|
||||||
|
|
||||||
|
client_cert.init_list();
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
45
lenticular_cloud/template/frontend/app_token_new.html.j2
Normal file
45
lenticular_cloud/template/frontend/app_token_new.html.j2
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{% extends 'frontend/base.html.j2' %}
|
||||||
|
|
||||||
|
{% block title %}{{ gettext('new client cert - {service_name}').format(service_name=service.name) }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div id="sign-key">
|
||||||
|
<h4>Sign Public Key</h4>
|
||||||
|
{{ render_form(form) }}
|
||||||
|
</div>
|
||||||
|
<div id="gen-key">
|
||||||
|
<h4>Generate new key in the browser</h4>
|
||||||
|
<div id="gen-key-sign" style="display: none">
|
||||||
|
{{ render_form(form) }}
|
||||||
|
</div>
|
||||||
|
<form id="gen-key-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="valid_time" class="control-label ">Key Password for .p12 (optional)</label>
|
||||||
|
<div class="">
|
||||||
|
<input class="form-control" id="cert-password" type="password" name="password"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="valid_time" class="control-label ">Key Size</label>
|
||||||
|
<div class="">
|
||||||
|
<select id="key-size" class="custom-select">
|
||||||
|
<option value="4096" selected>4096</option>
|
||||||
|
<option value="2048">2048</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group ">
|
||||||
|
<label for="valid_time" class="control-label ">valid time in days</label>
|
||||||
|
<div class="">
|
||||||
|
<input class="form-control" name="valid_time" required type="text" value="365">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<button id="generate-key" class="btn btn-primary" onclick="client_cert.generate_private_key()">Generate Key</button>
|
||||||
|
<a style="display: none" id="save-button" download="lenticular_cloud_{{ service.name }}.p12" class="btn btn-primary">Save Keypair</a>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
{#<a href="/"><img alt="logo" class="container-fluid" src="/static/images/dog_main_small.png"></a>#}
|
{#<a href="/"><img alt="logo" class="container-fluid" src="/static/images/dog_main_small.png"></a>#}
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.index') }}">{{ gettext('Account') }}</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.index') }}">{{ gettext('Account') }}</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.client_cert') }}">{{ gettext('Client Cert') }}</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.client_cert') }}">{{ gettext('Client Cert') }}</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.app_token') }}">{{ gettext('App Tokens') }}</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.totp') }}">{{ gettext('2FA - TOTP') }}</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.totp') }}">{{ gettext('2FA - TOTP') }}</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.oauth2_tokens') }}">{{ gettext('Oauth2 Tokens') }}</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.oauth2_tokens') }}">{{ gettext('Oauth2 Tokens') }}</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.password_change') }}">{{ gettext('Password Change') }}</a></li>
|
<li class="nav-item"><a class="nav-link" href="{{ url_for('frontend.password_change') }}">{{ gettext('Password Change') }}</a></li>
|
||||||
|
|
|
@ -133,6 +133,17 @@ def client_cert_new(service_name) -> ResponseReturnValue:
|
||||||
service=service,
|
service=service,
|
||||||
form=form)
|
form=form)
|
||||||
|
|
||||||
|
@frontend_views.route('/app_token')
|
||||||
|
def app_token() -> ResponseReturnValue:
|
||||||
|
return
|
||||||
|
|
||||||
|
@frontend_views.route('/app_token/<service_name>/new')
|
||||||
|
def app_token_new(service_name: str) -> ResponseReturnValue:
|
||||||
|
return
|
||||||
|
|
||||||
|
@frontend_views.route('/app_token/<service_name>/<token_name>')
|
||||||
|
def app_token_delete(service_name: str, token_name: str) -> ResponseReturnValue:
|
||||||
|
return
|
||||||
|
|
||||||
@frontend_views.route('/totp')
|
@frontend_views.route('/totp')
|
||||||
def totp() -> ResponseReturnValue:
|
def totp() -> ResponseReturnValue:
|
||||||
|
|
Loading…
Reference in a new issue