rodauth-oauth 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/authorize.html.erb +29 -0
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/new_oauth_application.html.erb +38 -0
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application.html.erb +17 -0
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_applications.html.erb +29 -0
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_tokens.html.erb +38 -0
- data/lib/rodauth/oauth/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbc2a014ad242752b436e810b24df8839c00c7a066b860e4cf418c16f19cfbad
|
4
|
+
data.tar.gz: e8c27858547f1df38662608cf74f6f75f48b438ec29137bfffd820320077b185
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8cabdea042eb26aaf1941ff9881f4cce9ffa4eb35557d7105d3c2195ced323f860654be7d161e56c85d91f7312fd041a39379516b97d6df47cf1637f273fb1f
|
7
|
+
data.tar.gz: d45c638c97f34705ddfe0ab124da3ed143188513454192aae65c4227d5e255ed0e5223fd3b3273418e2cc12896a7c175ce4786ecc20d6e611a1e4a3b28e412ca
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
<%= form_tag rodauth.authorize_path, method: :post do %>
|
2
|
+
<p class="lead">The application <%= rodauth.oauth_application[rodauth.oauth_applications_name_column] %> would like to access your data.</p>
|
3
|
+
|
4
|
+
<div class="form-group">
|
5
|
+
<h1 class="display-6"><%= rodauth.scopes_label %></h1>
|
6
|
+
|
7
|
+
<% rodauth.scopes.each do |scope| %>
|
8
|
+
<% is_default = scope == rodauth.oauth_application_default_scope %>
|
9
|
+
<div class="form-check">
|
10
|
+
<%= check_box_tag "scope[]", scope, is_default, disabled: is_default, id: scope, class: "form-check-input" %>
|
11
|
+
<%= label_tag scope, scope, class: "form-check-label" %>
|
12
|
+
<%= hidden_field_tag "scope[]", scope if is_default %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
<%= hidden_field_tag :client_id, params[:client_id] %>
|
16
|
+
<% %i[access_type response_type state nonce redirect_uri code_challenge code_challenge_method].each do |oauth_param| %>
|
17
|
+
<% if params[oauth_param] %>
|
18
|
+
<%= hidden_field_tag oauth_param, params[oauth_param] %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% if params[:response_mode] %>
|
22
|
+
<%= hidden_field_tag :response_mode, params[:response_mode] %>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
<p class="text-center">
|
26
|
+
<%= submit_tag "Authorize", class: "btn btn-outline-primary" %>
|
27
|
+
<%= link_to "Cancel", "#{rodauth.redirect_uri}?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request#{"&state=\#{rodauth.state}" if params[:state] }", class: "btn btn-outline-danger" %>
|
28
|
+
</p>
|
29
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<%= form_tag rodauth.oauth_applications_path, method: :post, class: "form-horizontal" do %>
|
2
|
+
<h2>Register Oauth Application</h2>
|
3
|
+
<%= rodauth.field_error('scope') %>
|
4
|
+
<div class="form-group">
|
5
|
+
<%= label_tag "name", "Name" %>
|
6
|
+
<%= text_field_tag "name", rodauth.param('name'), class: "form-control#{' is-invalid' if rodauth.field_error('name')}" %>
|
7
|
+
<%= rodauth.field_error('name') %>
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
10
|
+
<%= label_tag "description", "Description" %>
|
11
|
+
<%= text_field_tag "description", rodauth.param('description'), class: "form-control#{' is-invalid' if rodauth.field_error('description')}" %>
|
12
|
+
<%= rodauth.field_error('description') %>
|
13
|
+
</div>
|
14
|
+
<div class="form-group">
|
15
|
+
<%= label_tag "homepage_url", "Homepage URL" %>
|
16
|
+
<%= text_field_tag "homepage_url", rodauth.param('homepage_url'), class: "form-control#{' is-invalid' if rodauth.field_error('homepage_url')}" %>
|
17
|
+
<%= rodauth.field_error('homepage_url') %>
|
18
|
+
</div>
|
19
|
+
<div class="form-group">
|
20
|
+
<%= label_tag "redirect_uri", "Redirect URL" %>
|
21
|
+
<%= text_field_tag "redirect_uri", rodauth.param('redirect_uri'), class: "form-control#{' is-invalid' if rodauth.field_error('redirect_uri')}" %>
|
22
|
+
<%= rodauth.field_error('redirect_uri') %>
|
23
|
+
</div>
|
24
|
+
<div class="form-group">
|
25
|
+
<%= label_tag "client_secret", "Secret (make it random and at least 32 character-long)" %>
|
26
|
+
<%= text_field_tag "client_secret", rodauth.param('client_secret'), class: "form-control#{' is-invalid' if rodauth.field_error('client_secret')}" %>
|
27
|
+
<%= rodauth.field_error('client_secret') %>
|
28
|
+
</div>
|
29
|
+
<% rodauth.oauth_application_scopes.each do |scope| %>
|
30
|
+
<div class="form-check">
|
31
|
+
<%= check_box_tag "scopes[]", scope, scope == rodauth.oauth_application_default_scope, id: scope, class: "form-check-input" %>
|
32
|
+
<%= scope %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
<div class="form-group">
|
36
|
+
<%= submit_tag "Register", class: "btn btn-primary" %>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% oauth_application = rodauth.scope.instance_variable_get(:@oauth_application) %>
|
2
|
+
<div>
|
3
|
+
<h2><%= oauth_application[rodauth.oauth_applications_name_column] %></h2>
|
4
|
+
|
5
|
+
<dl>
|
6
|
+
<dt>Description: </dt>
|
7
|
+
<dd><%= oauth_application[rodauth.oauth_applications_description_column] %></dd>
|
8
|
+
<dt>Homepage URL: </dt>
|
9
|
+
<dd><%= oauth_application[rodauth.oauth_applications_homepage_url_column] %></dd>
|
10
|
+
<dt>Client ID: </dt>
|
11
|
+
<dd><%= oauth_application[rodauth.oauth_applications_client_id_column] %></dd>
|
12
|
+
<dt>Redirect URL: </dt>
|
13
|
+
<dd><%= oauth_application[rodauth.oauth_applications_redirect_uri_column] %></dd>
|
14
|
+
<dt>Scopes: </dt>
|
15
|
+
<dd><%= oauth_application[rodauth.oauth_applications_scopes_column] %></dd>
|
16
|
+
</dl>
|
17
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<% oauth_applications_ds = rodauth.scope.instance_variable_get(:@oauth_applications) %>
|
2
|
+
<% apps_count = oauth_applications_ds.count %>
|
3
|
+
<div class="btn-group" role="group" aria-label="Buttons">
|
4
|
+
<%= link_to "New Oauth Application", "#{rodauth.oauth_applications_path}/new", class: "btn btn-secondary" %>
|
5
|
+
</div>
|
6
|
+
<% if apps_count.zero? %>
|
7
|
+
<p>No oauth applications yet!</p>
|
8
|
+
<% else %>
|
9
|
+
<table class="table">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th scope="col">Client ID (<%= apps_count %>)</th>
|
13
|
+
<th scope="col">Name</th>
|
14
|
+
<th scope="col">Homepage</th>
|
15
|
+
<th scope="col"></th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
<tbody>
|
19
|
+
<% oauth_applications_ds.each do |application| %>
|
20
|
+
<tr>
|
21
|
+
<td><%= application[rodauth.oauth_applications_client_id_column] %></td>
|
22
|
+
<td><%= application[rodauth.oauth_applications_name_column] %></td>
|
23
|
+
<td><%= application[rodauth.oauth_applications_homepage_url_column] %></td>
|
24
|
+
<td><%= link_to "Show", rodauth.oauth_application_path(application[rodauth.oauth_applications_id_column]) %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<% oauth_tokens_ds = rodauth.scope.instance_variable_get(:@oauth_tokens) %>
|
2
|
+
<% tokens_count = oauth_tokens_ds.count %>
|
3
|
+
<% if tokens_count.zero? %>
|
4
|
+
<p>No oauth tokens yet!</p>
|
5
|
+
<% else %>
|
6
|
+
<table class="table">
|
7
|
+
<thead>
|
8
|
+
<tr>
|
9
|
+
<th scope="col">Token</th>
|
10
|
+
<th scope="col">Refresh Token</th>
|
11
|
+
<th scope="col">Expires in</th>
|
12
|
+
<th scope="col">Revoked at</th>
|
13
|
+
<th scope="col">Scopes</th>
|
14
|
+
<th scope="col"><span class="badge badge-pill badge-dark"><%= tokens_count %></span>
|
15
|
+
</tr>
|
16
|
+
</thead>
|
17
|
+
<tbody>
|
18
|
+
<% oauth_tokens_ds.each do |application| %>
|
19
|
+
<tr>
|
20
|
+
<td><code class="token"><%= oauth_token[rodauth.oauth_tokens_token_column] %></code></td>
|
21
|
+
<td><code class="token"><%= oauth_token[rodauth.oauth_tokens_refresh_token_column] %></code></td>
|
22
|
+
<td><%= oauth_token[rodauth.oauth_tokens_expires_in_column] %></td>
|
23
|
+
<td><%= oauth_token[rodauth.oauth_tokens_revoked_at_column] %></td>
|
24
|
+
<td><%= oauth_token[rodauth.oauth_tokens_scopes_column] %></td>
|
25
|
+
<td>
|
26
|
+
<% if !oauth_token[rodauth.oauth_tokens_revoked_at_column] %>
|
27
|
+
<%= form_tag rodauth.revoke_path, method: :post do %>
|
28
|
+
<%= hidden_field_tag :token_type_hint, "access_token" %>
|
29
|
+
<%= hidden_field_tag :token, oauth_token[rodauth.oauth_tokens_token_column] %>
|
30
|
+
<%= submit_tag "Revoke", class: "btn btn-danger" %>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
</td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
36
|
+
</tbody>
|
37
|
+
</table>
|
38
|
+
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
@@ -41,6 +41,11 @@ files:
|
|
41
41
|
- lib/generators/rodauth/oauth/templates/app/models/oauth_application.rb
|
42
42
|
- lib/generators/rodauth/oauth/templates/app/models/oauth_grant.rb
|
43
43
|
- lib/generators/rodauth/oauth/templates/app/models/oauth_token.rb
|
44
|
+
- lib/generators/rodauth/oauth/templates/app/views/rodauth/authorize.html.erb
|
45
|
+
- lib/generators/rodauth/oauth/templates/app/views/rodauth/new_oauth_application.html.erb
|
46
|
+
- lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application.html.erb
|
47
|
+
- lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_applications.html.erb
|
48
|
+
- lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_tokens.html.erb
|
44
49
|
- lib/generators/rodauth/oauth/templates/db/migrate/create_rodauth_oauth.rb
|
45
50
|
- lib/generators/rodauth/oauth/views_generator.rb
|
46
51
|
- lib/rodauth/features/oauth.rb
|
@@ -67,7 +72,7 @@ files:
|
|
67
72
|
- templates/scope_field.str
|
68
73
|
homepage: https://gitlab.com/honeyryderchuck/rodauth-oauth
|
69
74
|
licenses:
|
70
|
-
- Apache
|
75
|
+
- Apache-2.0
|
71
76
|
metadata:
|
72
77
|
homepage_uri: https://honeyryderchuck.gitlab.io/rodauth-oauth/
|
73
78
|
documentation_uri: https://honeyryderchuck.gitlab.io/rodauth-oauth/rdoc/
|