[60ada4]: / Allura / allura / templates / oauth_applications.html  Maximize  Restore  History

Download this file

143 lines (132 with data), 5.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{#-
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 %}OAuth 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() {
$('.deregister_consumer_token').submit(function(e) {
var ok = confirm('Deregister application and revoke all its access tokens?')
if(!ok) {
e.preventDefault();
return false;
}
});
$('.revoke_access_token').submit(function(e) {
var ok = confirm('Revoke access?')
if(!ok) {
e.preventDefault();
return false;
}
});
})
</script>
{% endblock %}
{% block content %}
{{ super() }}
<h2>Authorized Applications</h2>
<p>
These are applications you have authorized to act on your behalf.
They potentially have full access to your account, so if you are
no longer using an application listed here, you should revoke its
access.
</p>
{% for access_token in access_tokens %}
<table class="authorized_app">
<tr class="name">
<th>Name:</th><td>{{access_token.consumer_token.name}}</td>
</tr>
<tr class="description">
<th>Description:</th><td>{{access_token.consumer_token.description_html }}</td>
</tr>
{% if access_token.is_bearer %}
<tr class="bearer_token">
<th>Bearer Token:</th><td>{{access_token.api_key}}</td>
</tr>
{% endif %}
<tr>
<th>Last Access:</th><td>{% if access_token.last_access %} {{ access_token.last_access.strftime('%a %b %d, %Y %I:%M %p UTC') }} {% endif %}</td>
</tr>
<tr class="controls">
<td colspan="2">
<form method="POST" action="revoke_access_token" class="revoke_access_token">
<input type="hidden" name="_id" value="{{access_token._id}}"/>
<input type="submit" value="Revoke"/>
{{lib.csrf_token()}}
</form>
</td>
</tr>
</table>
{% endfor %}
<h2>My Applications</h2>
<p>
These are the applications you have registered. They can request authorization
for a user using the Consumer Key and Consumer Secret via OAuth negotiation.
Alternatively, you can generate a bearer token to give your application access
to your account without having to perform the OAuth negotiation. Note, however,
that you must be careful with bearer tokens, since anyone who has the token can
access your account as that application.
</p>
{% for consumer_token in consumer_tokens %}
<table class="registered_app">
<tr><th>Name:</th><td>{{consumer_token.name}}</td></tr>
<tr class="description"><th>Description:</th><td>{{consumer_token.description_html }}</td></tr>
<tr class="consumer_key"><th>Consumer Key:</th><td>{{consumer_token.api_key}}</td></tr>
<tr class="consumer_secret"><th>Consumer Secret:</th><td>{{consumer_token.secret_key}}</td></tr>
<tr class="controls">
<td colspan="2">
<form method="POST" action="deregister" class="deregister_consumer_token">
<input type="hidden" name="_id" value="{{consumer_token._id}}"/>
<input type="submit" value="Deregister"/>
{{lib.csrf_token()}}
</form>
<form method="POST" action="generate_access_token" class="generate_access_token">
<input type="hidden" name="_id" value="{{consumer_token._id}}"/>
<input type="submit" value="Generate Bearer Token"/>
{{lib.csrf_token()}}
</form>
</td>
</tr>
</table>
{% endfor %}
<h2>Register New Application</h2>
{{ c.form.display() }}
{% endblock %}