Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Closes #206.
- Loading branch information
Showing
12 changed files
with
646 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/authorize.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
|
||
{%- extends config.OAUTH2SERVER_COVER_TEMPLATE %} | ||
|
||
{%- import "invenio_oauth2server/settings/helpers.html" as helpers with context %} | ||
|
||
{% block page_body %} | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
{{ helpers.panel_start(_('Authorize application'), icon='fa fa-shield fa-fw') }} | ||
<h1 align="center">{{ _('Authorize application') }}</h1> | ||
<h3 align="center">{{ _("Application '%(client_name)s' by '%(client_user)s' wants permission to access your '%(current_user)s' account.", | ||
client_name=client.name, client_user=client.user.nickname or client.user.email, current_user=current_user.nickname or current_user.email) }}</h3> | ||
<hr /> | ||
<div class="row"> | ||
<div class="col-md-8"> | ||
<div class="text-left"> | ||
|
||
<h4>{{ _('Review permissions') }}</h4> | ||
{%- for group in scopes|groupby('group') %} | ||
{%- if loop.first %}<table class="table table-striped table-bordered"><tbody>{% endif %} | ||
<tr> | ||
<td><strong>{{group.grouper}}</strong></td> | ||
<td><ul>{% for scope in group.list %}<li>{{scope.help_text}}</li>{% endfor %}</ul></td> | ||
</tr> | ||
{%- if loop.last %}</tbody></table>{% endif %} | ||
{%- else %} | ||
<p><em>No permissions granted.</em></p> | ||
{%- endfor %} | ||
</div> | ||
</div> | ||
<div class="col-md-4"> | ||
<div class="well"> | ||
<div class="text-left"> | ||
<span class="text-muted">{{ _('Application') }}</span> | ||
<h4>{{client.name}}</h4> | ||
{%- if client.description %}<p>{{client.description}}</p>{% endif %} | ||
{%- if client.website %}<p><a href="{{client.website}}">{{ _('Visit application website') }}</a></p>{% endif %} | ||
<hr /> | ||
<p class="text-center text-muted"> | ||
<i class="fa fa-users"></i> {{ client.get_users }} {{ 'user' if client.get_users == 1 else 'users' }} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<hr /> | ||
<div align="center"> | ||
<form action="" method="POST"> | ||
<button type="submit" value="yes" name="confirm" class="btn btn-success"><i class="fa fa-check"></i> {{ _('Authorize application') }}</button> | ||
<button type="submit" value="no" name="confirm" class="btn btn-danger"><i class="fa fa-ban"></i> {{ _('Reject') }}</button> | ||
</form> | ||
</div> | ||
{{ helpers.panel_end() }} | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
17 changes: 17 additions & 0 deletions
17
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
</head> | ||
<body> | ||
{%- block page_body %}{%- endblock page_body %} | ||
</body> | ||
</html> |
37 changes: 37 additions & 0 deletions
37
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/errors.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
|
||
{%- extends config.OAUTH2SERVER_COVER_TEMPLATE %} | ||
|
||
{%- import "invenio_oauth2server/settings/helpers.html" as helpers with context %} | ||
|
||
{%- block page_body %} | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
{{ helpers.panel_start( | ||
_('Invalid authorization request'), | ||
icon='fa fa-warning fa-fw' | ||
) }} | ||
|
||
{{ _('Invalid authorization request') }} | ||
|
||
{{ _('The service that redirected your here made an invalid authorization request (error code: %(x_error)s).', | ||
x_error=error.error) }} | ||
|
||
<div class="row"> | ||
<hr /> | ||
<div align="center"> | ||
<a href="/" class="btn btn-info"> | ||
{{ _('Get me out of here!') }} | ||
</a> | ||
</div> | ||
{{ helpers.panel_end() }} | ||
</div> | ||
</div> | ||
{%- endblock %} |
67 changes: 67 additions & 0 deletions
67
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/settings/_macros.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
|
||
{% macro render_field(field, icon='', placeholder='', autofocus=False) %} | ||
{%- if field.widget.input_type == 'hidden' %} | ||
{{ field() }} | ||
{%- else %} | ||
<div class="field"> | ||
<label>{{ field.label }}</label> | ||
<div class="ui right icon input"> | ||
{%- if icon %} | ||
<i class="{{icon}}" aria-hidden="true" ></i> | ||
{%- endif %} | ||
{%- set extras = dict(autofocus='') if autofocus else dict() %} | ||
{{ field(placeholder=_(field.label.text | string), **extras) }} | ||
</div> | ||
{%- if field.description %} | ||
<small>{{ field.description }}</small> | ||
{%- endif %} | ||
{%- if field.errors and errormsg %} --> | ||
<div class="ui pointing red basic label"> | ||
{%- for error in field.errors %} | ||
<p>{{error}}</p> | ||
{%- endfor %} | ||
</div> | ||
{%- endif %} | ||
</div> | ||
{%- endif %} | ||
{% endmacro %} | ||
|
||
{% macro render_scopes_field(field) %} | ||
<div class="field"> | ||
<label>{{ field.label }}</label> | ||
<div class="ui grid"> | ||
{% for value, label, checked in field.iter_choices() %} | ||
{%- set choice_id = field.id ~ "-" ~ value %} | ||
<div class="four wide column"> | ||
<div class="inline field"> | ||
<div class="ui checkbox"> | ||
<input id="{{ choice_id }}" {% if checked %} checked {% endif %} value="{{ value }}" name="{{ field.name }}" type="checkbox" class="hidden"> | ||
<label for="{{ choice_id }}"> | ||
{{ value }}<br/> | ||
<small>{{ label.help_text }}</small> | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
{%- if field.description %} | ||
<small>{{ field.description }}</small> | ||
{%- endif %} | ||
{%- if field.errors and errormsg %} --> | ||
<div class="ui pointing red basic label"> | ||
{%- for error in field.errors %} | ||
<p>{{error}}</p> | ||
{%- endfor %} | ||
</div> | ||
{%- endif %} | ||
</div> | ||
{% endmacro %} |
17 changes: 17 additions & 0 deletions
17
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/settings/base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
{%- extends "invenio_oauth2server/base.html" %} | ||
|
||
{%- block page_body %} | ||
{%- block settings_content %} | ||
{%- block settings_body %} | ||
{%- block settings_form %}{%- endblock settings_form %} | ||
{%- endblock settings_body %} | ||
{%- endblock settings_content %} | ||
{%- endblock page_body %} |
31 changes: 31 additions & 0 deletions
31
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/settings/client_new.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
|
||
{%- extends "invenio_oauth2server/settings/index.html" %} | ||
|
||
{%- import "invenio_oauth2server/settings/helpers.html" as helpers with context %} | ||
{%- from "invenio_oauth2server/settings/_macros.html" import render_field with context %} | ||
|
||
{% block settings_content %} | ||
{{ helpers.panel_start( | ||
_('New OAuth Application'), | ||
) }} | ||
<form class="ui form" role="form" method="POST"> | ||
{%- for field in form %} | ||
{{ render_field(field) }} | ||
{%- endfor %} | ||
<a href="{{ url_for('.index') }}" class="ui button secondary basic"> | ||
<i class="icon x"></i> {{ _('Cancel') }} | ||
</a> | ||
<button type="submit" class="ui button primary"> | ||
<i class="icon check"></i> {{ _('Register') }} | ||
</button> | ||
</form> | ||
{{ helpers.panel_end() }} | ||
{% endblock %} |
110 changes: 110 additions & 0 deletions
110
invenio_oauth2server/templates/semantic-ui/invenio_oauth2server/settings/client_view.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
Copyright (C) 2015-2020 CERN. | ||
|
||
Invenio is free software; you can redistribute it and/or modify it | ||
under the terms of the MIT License; see LICENSE file for more details. | ||
#} | ||
|
||
{%- extends "invenio_oauth2server/settings/index.html" %} | ||
|
||
{%- import "invenio_oauth2server/settings/helpers.html" as helpers with context %} | ||
{%- from "invenio_oauth2server/settings/_macros.html" import render_field with context %} | ||
|
||
{% block settings_content %} | ||
{{ helpers.panel_start( | ||
_('Application / %(client_name)s', client_name=client.name), | ||
with_body=False, | ||
) }} | ||
<div class="ui segment"> | ||
<h4 class="ui header"> | ||
Client ID | ||
<div class="sub header"> | ||
<code>{{ client.client_id }}</code> | ||
</div> | ||
</h4> | ||
<h4 class="ui header"> | ||
Client Secret | ||
<div class="sub header"> | ||
<code>{{ client.client_secret }}</code> | ||
<br><small class="text-muted">{{ _('Do not share the client secret with anyone!') }}</small></p> | ||
</div> | ||
</h4> | ||
<form class="ui form" method="POST" action="{{ url_for('.client_reset', client_id=client.client_id) }}"> | ||
<input type="hidden" name="reset" value="yes"> | ||
<button type="submit" class="ui button negative"> | ||
<i class="icon ban"></i> {{ _('Reset client secret') }} | ||
</button> | ||
</form> | ||
</div> | ||
{%- block client_footer_text %}{%- endblock client_footer_text %} | ||
<div class="ui segment"> | ||
<form class="ui form" method="POST" role="form" action=""> | ||
{%- for field in form %} | ||
{{ render_field(field) }} | ||
{%- endfor %} | ||
|
||
<button type="submit" name="save" class="ui button primary"> | ||
<i class="icon check"></i> {{ _('Save') }} | ||
</button> | ||
<button type="submit" name="delete" class="ui button negative"> | ||
<i class="icon trash"></i> {{ _('Delete') }} | ||
</button> | ||
</form> | ||
</div> | ||
{{helpers.panel_end(with_body=False)}} | ||
|
||
{{helpers.panel_start(_('OAuth 2.0 Endpoints'))}} | ||
<div class="ui equal width grid"> | ||
<div class="column"> | ||
<p> | ||
<h3 class="ui header"> | ||
{{ _('Authorize URL (GET)') }} | ||
<div class="sub header"> | ||
{{ url_for('invenio_oauth2server.authorize', _external=True, _scheme='https')}} | ||
</div> | ||
</h3> | ||
<small class="text-muted"> | ||
{{ _('Query parameters') }} (<a href="{{ url_for( | ||
'invenio_oauth2server.authorize', response_type='code', | ||
client_id=client.client_id, | ||
scope='deposit:write deposit:actions', | ||
state='CHANGEME', | ||
redirect_uri=client.default_redirect_uri, | ||
_external=False) }}"> | ||
{{_('example request')}} | ||
</a>): | ||
<ul> | ||
<li>response_type (required, use <code>code</code> or <code>token</code>)</li> | ||
<li>client_id (required)</li> | ||
<li>scope (required, space separate list of scopes)</li> | ||
<li>redirect_uri (required, URL encoded)</li> | ||
<li>state (recommended, for CSRF protection)</li> | ||
</ul> | ||
</small> | ||
</p> | ||
</div> | ||
<div class="column"> | ||
<p> | ||
<h3 class="ui header"> | ||
{{ _('Access token URL (POST)') }} | ||
<div class="sub header"> | ||
{{ url_for('invenio_oauth2server.access_token', _external=True, _scheme='https')}} | ||
</div> | ||
</h3> | ||
<small class="text-muted">Request body parameters: | ||
<ul> | ||
<li>client_id (required).</li> | ||
<li>client_secret (required).</li> | ||
<li>grant_type (required, use {% for c in config.OAUTH2SERVER_ALLOWED_GRANT_TYPES %}<code>{{c}}</code>{% if not loop.last %}, {% endif %}{% endfor %}).</li> | ||
<li>code (required for grant_type <code>authorization code</code>).</li> | ||
<li>scope (required for grant_type <code>client_credentials</code>).</li> | ||
<li>refresh_token (required for grant_type <code>refresh_token</code>).</li> | ||
</ul> | ||
</small> | ||
</p> | ||
</div> | ||
</div> | ||
{{helpers.panel_end()}} | ||
{% endblock settings_content %} |
Oops, something went wrong.