| {#- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| -#} |
| {% set hide_left_bar = True %} |
| {% extends "allura:templates/user_account_base.html" %} |
| |
| {% block title %}{{c.user.username}} / Applications {% endblock %} |
| |
| {% block header %}OAuth2 applications registered for {{c.user.username}}{% endblock %} |
| |
| {% block extra_css %} |
| <style type="text/css"> |
| table { |
| border: 1px solid #e5e5e5; |
| } |
| th { |
| text-align: left; |
| width: 10em; |
| padding: 5px; |
| border: 1px solid #e5e5e5; |
| } |
| tr.description p { |
| padding-left: 0; |
| } |
| tr.description p:last-child { |
| padding-bottom: 0; |
| } |
| tr.controls input[type="submit"] { |
| margin-bottom: 0; |
| } |
| </style> |
| {% endblock %} |
| |
| {% block extra_js %} |
| <script type="text/javascript"> |
| $(function() { |
| var btnClicked; |
| |
| // The click event will always trigger before the submit event, this will give us the chance to |
| // figure out which button was clicked in order to display the correct confirmation dialog |
| $('#deregister,#revoke').click(function(){ |
| btnClicked = this.name; |
| }); |
| |
| $('.client_action').submit(function(e) { |
| var confirmMsg; |
| |
| if(btnClicked === 'deregister') { |
| confirmMsg = 'Deregister client?. This action will also revoke authorization and access tokens.' |
| } |
| |
| if(btnClicked === 'revoke') { |
| confirmMsg = "Revoke client's authorization codes and access tokens?. This action will not delete the current client." |
| } |
| |
| var ok = confirm(confirmMsg) |
| if(!ok) { |
| e.preventDefault(); |
| return false; |
| } |
| }); |
| }) |
| </script> |
| {% endblock %} |
| |
| {% block content %} |
| {{ super() }} |
| |
| <h2>My Clients</h2> |
| <p> |
| These are the clients you have registered. They can request authorization |
| for a user by sending the client id and a response type. |
| Once you have an authorization code, you can generate an access token to give your client access |
| to your account and use a refresh token to generate a new one each time it expires. Note, however, |
| that you must be careful with access tokens, since anyone who has the token can |
| access your account as that client. |
| </p> |
| {% for app in model %} |
| <table class="registered_app"> |
| <tr><th>Name:</th><td>{{app.client.name}}</td></tr> |
| <tr class="description"><th>Description:</th><td>{{app.client.description }}</td></tr> |
| <tr class="client_id"><th>Client ID:</th><td>{{app.client.client_id}}</td></tr> |
| <tr class="redirect_url"><th>Redirect URL:</th><td>{{app.client.redirect_uris[0] if app.client.redirect_uris else ''}}</td></tr> |
| |
| {% if app.authorization %} |
| <tr class="grant_type"><th>Grant Type:</th><td>{{app.client.grant_type}}</td></tr> |
| <tr class="authorization_code"><th>Authorization Code:</th><td>{{app.authorization.authorization_code}}</td></tr> |
| <tr class="authorization_code_expires"><th>Authorization Code Expires At:</th><td>{{app.authorization.expires_at.strftime('%Y-%m-%d %H:%M:%S')}} UTC</td></tr> |
| {% endif %} |
| |
| {% if app.token %} |
| <tr class="access_token"><th>Access Token:</th><td>{{app.token.access_token}}</td></tr> |
| <tr class="access_token_expires"><th>Access Token Expires At:</th><td>{{app.token.expires_at.strftime('%Y-%m-%d %H:%M:%S')}} UTC</td></tr> |
| <tr class="refresh_token"><th>Refresh Token:</th><td>{{app.token.refresh_token}}</td></tr> |
| {% endif %} |
| |
| <tr class="controls"> |
| <td colspan="2"> |
| <form method="POST" action="do_client_action" class="client_action"> |
| <input type="hidden" name="_id" value="{{app.client.client_id}}"/> |
| <input id="deregister" type="submit" name="deregister" value="Deregister Client"/> |
| <input id="revoke" type="submit" name="revoke" value="Revoke Access"/> |
| {{lib.csrf_token()}} |
| </form> |
| </td> |
| </tr> |
| </table> |
| {% endfor %} |
| |
| <h2>Register New Application</h2> |
| {{ c.form.display() }} |
| {% endblock %} |