rodauth-oauth 0.6.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -0
- data/README.md +12 -5
- data/lib/generators/rodauth/oauth/views_generator.rb +1 -1
- data/lib/rodauth/features/oauth.rb +62 -21
- data/lib/rodauth/features/oauth_jwt.rb +2 -2
- data/lib/rodauth/features/oidc.rb +13 -1
- data/lib/rodauth/oauth/version.rb +1 -1
- data/locales/en.yml +35 -0
- data/templates/authorize.str +18 -8
- data/templates/oauth_application.str +2 -2
- data/templates/oauth_tokens.str +10 -8
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d000e6a25796dbdc8c58d378e93819343810f6089c33d02732443342ce721ec3
|
4
|
+
data.tar.gz: e61c19bd7e74c3f2b68541bf7aa78c143c669d5a745bf4efc389e786598fbcd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d727127c9e5a6d3a935b6194fbd0bd81358f3ea9876387d1639c3cf419b15246a0b89d57688d8ef15e830bd7b86f482463332c0fa843cb494ee56afe23c3e2e
|
7
|
+
data.tar.gz: 1d565e48e99b4897ca47a64c5b937405a5a10a9696893059d59670e58ae0dc1677daf17194ddfefcdd0d9fc33960ab5fd3a1fd3716cbe0e7fae961537ad46058
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,67 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
### 0.7.2 (14/12/2021)
|
6
|
+
|
7
|
+
#### Features
|
8
|
+
|
9
|
+
* Revoking tokens from the OAuth Application management interface (@muellerj)
|
10
|
+
|
11
|
+
Token revocation was only possible when using the client ID and Secret, to aid "logout" functionality from client applications. Although the admin interface (available via `r.oauth_applications`) displayed a "Revoke" button alongside tokens in the list page, this was not working. The RFC does allow for the use case of application administrators being able to manually revoke tokens (as a result of client support, for example), so this functionality was enabled (only for the oauth application owner, for now).
|
12
|
+
|
13
|
+
#### Bugfixes
|
14
|
+
|
15
|
+
Default scope usage related bugfixes:
|
16
|
+
|
17
|
+
* Improved default scope conversion to avoid nested arrays (@muellerj);
|
18
|
+
* Authorize form shows a disabled checkbox and POST's no scope when default scope is to be used (@muellerj);
|
19
|
+
* example default scope fixed for example authorization server (should be string) (@muellerj);
|
20
|
+
* several param fixes in view templates (@muellerj);
|
21
|
+
|
22
|
+
OAuth Applications Management fixes:
|
23
|
+
|
24
|
+
* Access to OAuth Application page is now restricted to app owner;
|
25
|
+
* OAuth Applications page now lists the **only** the applications owned by the logged in user;
|
26
|
+
|
27
|
+
### 0.7.1 (05/12/2021)
|
28
|
+
|
29
|
+
#### Improvements
|
30
|
+
|
31
|
+
* Adapted the `rodauth-i18n` configuration to comply with the guidelines for `v0.2.0` (which is the defacto minimmal supported version).
|
32
|
+
|
33
|
+
#### Bugfixes
|
34
|
+
|
35
|
+
* `convert_timestamp` was removed from the templates, as it's private API.
|
36
|
+
* Several missing or wrong URLs in templates fixed (authorize form was wrongly processing scopes when none was selected).
|
37
|
+
|
38
|
+
### 0.7.0 (02/12/2021)
|
39
|
+
|
40
|
+
#### Features
|
41
|
+
|
42
|
+
* Internationalization (i18n) support by hooking on [rodauth-i18n](https://github.com/janko/rodauth-i18n).
|
43
|
+
* Sets all text using `translatable_method`.
|
44
|
+
* Provides english translations for all `rodauth-oauth` related user facing text.
|
45
|
+
|
46
|
+
#### Improvements
|
47
|
+
|
48
|
+
* Enable CORS requests for OpenID configuration endpoint (@ianks)
|
49
|
+
* Introspect endpoint now exposes the `exp` token property (@gmanley)
|
50
|
+
|
51
|
+
#### Bugfixes
|
52
|
+
|
53
|
+
* on rotation policy, although the first refresh token was invalidated, a new one wasn't being provided. This change allows a new refresh token to be generated and exposed in the response (@gmanley)
|
54
|
+
|
55
|
+
#### Chore
|
56
|
+
|
57
|
+
Setting `rodauth` minimal supported version to `2.0.0`.
|
58
|
+
|
59
|
+
### 0.6.1 (08/09/2021)
|
60
|
+
|
61
|
+
#### Bugfixes
|
62
|
+
|
63
|
+
* Fixed rails view templates escaping.
|
64
|
+
* Fixed declaration of authorize template in the generator.
|
65
|
+
|
5
66
|
### 0.6.0 (21/05/2021)
|
6
67
|
|
7
68
|
### Improvements
|
data/README.md
CHANGED
@@ -173,7 +173,7 @@ puts payload #=> {"access_token" => "awr23f3h8f9d2h89...", "token_type" => "Bear
|
|
173
173
|
|
174
174
|
#### Revoking tokens
|
175
175
|
|
176
|
-
Token revocation can be done both by the
|
176
|
+
Token revocation can be done both by the identity owner or the application owner, and can therefore be done either online (browser-based form) or server-to-server. Here's an example using server-to-server:
|
177
177
|
|
178
178
|
```ruby
|
179
179
|
require "httpx"
|
@@ -516,7 +516,7 @@ payload = json.parse(response.to_s)
|
|
516
516
|
puts payload #=> {
|
517
517
|
# "access_token" => ....
|
518
518
|
# "mac_key" => ....
|
519
|
-
# "mac_algorithm" =>
|
519
|
+
# "mac_algorithm" =>
|
520
520
|
```
|
521
521
|
|
522
522
|
which you'll be able to use to generate the mac signature to send in the "Authorization" header.
|
@@ -565,7 +565,7 @@ plugin :rodauth do
|
|
565
565
|
enable :oauth_jwt
|
566
566
|
oauth_jwt_key rsa_private
|
567
567
|
oauth_jwt_public_key rsa_public
|
568
|
-
oauth_jwt_algorithm "RS256"
|
568
|
+
oauth_jwt_algorithm "RS256"
|
569
569
|
end
|
570
570
|
```
|
571
571
|
|
@@ -581,7 +581,7 @@ plugin :rodauth do
|
|
581
581
|
enable :oauth_jwt
|
582
582
|
oauth_jwt_jwk_key rsa_private
|
583
583
|
oauth_jwt_jwk_public_key rsa_public
|
584
|
-
oauth_jwt_jwk_algorithm "RS256"
|
584
|
+
oauth_jwt_jwk_algorithm "RS256"
|
585
585
|
end
|
586
586
|
```
|
587
587
|
|
@@ -627,6 +627,14 @@ puts payload #=> {
|
|
627
627
|
|
628
628
|
You'll still need the "oauth_tokens" table, however you can remove the "token" column.
|
629
629
|
|
630
|
+
#### Internationalization (i18n)
|
631
|
+
|
632
|
+
`rodauth-oauth` supports translating all user-facing text found in all pages and forms, by integrating with [rodauth-i18n](https://github.com/janko/rodauth-i18n). Just set it up in your application and `rodauth` configuration.
|
633
|
+
|
634
|
+
Default translations shipping with `rodauth-oauth` can be found [in this directory](https://gitlab.com/honeyryderchuck/rodauth-oauth/-/tree/master/locales). If they're not available for the languages you'd like to support, consider getting them translated from the english text, and contributing them to this repository via a Merge Request.
|
635
|
+
|
636
|
+
(This feature is available since `v0.7`.)
|
637
|
+
|
630
638
|
#### Caveats
|
631
639
|
|
632
640
|
Although very handy for the mentioned use case, one can't revoke a JWT token on demand (it must expire first).
|
@@ -646,4 +654,3 @@ After checking out the repo, run `bundle install` to install dependencies. Then,
|
|
646
654
|
## Contributing
|
647
655
|
|
648
656
|
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/honeyryderchuck/rodauth-oauth.
|
649
|
-
|
@@ -9,7 +9,7 @@ module Rodauth::OAuth
|
|
9
9
|
source_root "#{__dir__}/templates"
|
10
10
|
namespace "rodauth:oauth:views"
|
11
11
|
|
12
|
-
DEFAULT = %w[
|
12
|
+
DEFAULT = %w[authorize].freeze
|
13
13
|
VIEWS = {
|
14
14
|
oauth_authorize: DEFAULT,
|
15
15
|
oauth_applications: %w[oauth_applications oauth_application new_oauth_application]
|
@@ -66,6 +66,7 @@ module Rodauth
|
|
66
66
|
notice_flash "Your oauth application has been registered", "create_oauth_application"
|
67
67
|
|
68
68
|
notice_flash "The oauth token has been revoked", "revoke_oauth_token"
|
69
|
+
error_flash "You are not authorized to revoke this token", "revoke_unauthorized_account"
|
69
70
|
|
70
71
|
view "authorize", "Authorize", "authorize"
|
71
72
|
view "oauth_applications", "Oauth Applications", "oauth_applications"
|
@@ -168,24 +169,24 @@ module Rodauth
|
|
168
169
|
auth_value_method :oauth_token_type, "bearer"
|
169
170
|
auth_value_method :oauth_refresh_token_protection_policy, "none" # can be: none, sender_constrained, rotation
|
170
171
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
172
|
+
translatable_method :invalid_client_message, "Invalid client"
|
173
|
+
translatable_method :invalid_grant_type_message, "Invalid grant type"
|
174
|
+
translatable_method :invalid_grant_message, "Invalid grant"
|
175
|
+
translatable_method :invalid_scope_message, "Invalid scope"
|
175
176
|
|
176
|
-
|
177
|
-
|
177
|
+
translatable_method :invalid_url_message, "Invalid URL"
|
178
|
+
translatable_method :unsupported_token_type_message, "Invalid token type hint"
|
178
179
|
|
179
|
-
|
180
|
-
|
181
|
-
|
180
|
+
translatable_method :unique_error_message, "is already in use"
|
181
|
+
translatable_method :null_error_message, "is not filled"
|
182
|
+
translatable_method :already_in_use_message, "error generating unique token"
|
182
183
|
auth_value_method :already_in_use_error_code, "invalid_request"
|
183
184
|
|
184
185
|
# PKCE
|
185
186
|
auth_value_method :code_challenge_required_error_code, "invalid_request"
|
186
|
-
|
187
|
+
translatable_method :code_challenge_required_message, "code challenge required"
|
187
188
|
auth_value_method :unsupported_transform_algorithm_error_code, "invalid_request"
|
188
|
-
|
189
|
+
translatable_method :unsupported_transform_algorithm_message, "transform algorithm not supported"
|
189
190
|
|
190
191
|
# METADATA
|
191
192
|
auth_value_method :oauth_metadata_service_documentation, nil
|
@@ -279,7 +280,13 @@ module Rodauth
|
|
279
280
|
next unless is_authorization_server?
|
280
281
|
|
281
282
|
before_revoke_route
|
282
|
-
|
283
|
+
|
284
|
+
if logged_in?
|
285
|
+
require_account
|
286
|
+
require_oauth_application_from_account
|
287
|
+
else
|
288
|
+
require_oauth_application
|
289
|
+
end
|
283
290
|
|
284
291
|
r.post do
|
285
292
|
catch_error do
|
@@ -386,7 +393,10 @@ module Rodauth
|
|
386
393
|
end
|
387
394
|
|
388
395
|
request.on(oauth_applications_id_pattern) do |id|
|
389
|
-
oauth_application = db[oauth_applications_table]
|
396
|
+
oauth_application = db[oauth_applications_table]
|
397
|
+
.where(oauth_applications_id_column => id)
|
398
|
+
.where(oauth_applications_account_id_column => account_id)
|
399
|
+
.first
|
390
400
|
next unless oauth_application
|
391
401
|
|
392
402
|
scope.instance_variable_set(:@oauth_application, oauth_application)
|
@@ -407,7 +417,8 @@ module Rodauth
|
|
407
417
|
end
|
408
418
|
|
409
419
|
request.get do
|
410
|
-
scope.instance_variable_set(:@oauth_applications, db[oauth_applications_table]
|
420
|
+
scope.instance_variable_set(:@oauth_applications, db[oauth_applications_table]
|
421
|
+
.where(oauth_applications_account_id_column => account_id))
|
411
422
|
oauth_applications_view
|
412
423
|
end
|
413
424
|
|
@@ -474,7 +485,7 @@ module Rodauth
|
|
474
485
|
when String
|
475
486
|
scope.split(" ")
|
476
487
|
when nil
|
477
|
-
|
488
|
+
Array(oauth_application_default_scope)
|
478
489
|
end
|
479
490
|
end
|
480
491
|
|
@@ -570,6 +581,8 @@ module Rodauth
|
|
570
581
|
end
|
571
582
|
|
572
583
|
self.class.send(:define_method, :__one_oauth_token_per_account) { one_oauth_token_per_account }
|
584
|
+
|
585
|
+
i18n_register(File.expand_path(File.join(__dir__, "..", "..", "..", "locales"))) if features.include?(:i18n)
|
573
586
|
end
|
574
587
|
|
575
588
|
def use_date_arithmetic?
|
@@ -682,6 +695,20 @@ module Rodauth
|
|
682
695
|
authorization_required unless @oauth_application && secret_matches?(@oauth_application, client_secret)
|
683
696
|
end
|
684
697
|
|
698
|
+
def require_oauth_application_from_account
|
699
|
+
ds = db[oauth_applications_table]
|
700
|
+
.join(oauth_tokens_table, Sequel[oauth_tokens_table][oauth_tokens_oauth_application_id_column] =>
|
701
|
+
Sequel[oauth_applications_table][oauth_applications_id_column])
|
702
|
+
.where(oauth_token_by_token_ds(param("token")).opts.fetch(:where, true))
|
703
|
+
.where(Sequel[oauth_applications_table][oauth_applications_account_id_column] => account_id)
|
704
|
+
|
705
|
+
@oauth_application = ds.qualify.first
|
706
|
+
return if @oauth_application
|
707
|
+
|
708
|
+
set_redirect_error_flash revoke_unauthorized_account_error_flash
|
709
|
+
redirect request.referer || "/"
|
710
|
+
end
|
711
|
+
|
685
712
|
def secret_matches?(oauth_application, secret)
|
686
713
|
BCrypt::Password.new(oauth_application[oauth_applications_client_secret_column]) == secret
|
687
714
|
end
|
@@ -772,17 +799,21 @@ module Rodauth
|
|
772
799
|
end
|
773
800
|
end
|
774
801
|
|
775
|
-
def
|
802
|
+
def oauth_token_by_token_ds(token)
|
776
803
|
ds = db[oauth_tokens_table]
|
777
804
|
|
778
805
|
ds = if oauth_tokens_token_hash_column
|
779
|
-
ds.where(oauth_tokens_token_hash_column => generate_token_hash(token))
|
806
|
+
ds.where(Sequel[oauth_tokens_table][oauth_tokens_token_hash_column] => generate_token_hash(token))
|
780
807
|
else
|
781
|
-
ds.where(oauth_tokens_token_column => token)
|
808
|
+
ds.where(Sequel[oauth_tokens_table][oauth_tokens_token_column] => token)
|
782
809
|
end
|
783
810
|
|
784
|
-
ds.where(Sequel[oauth_tokens_expires_in_column] >= Sequel::CURRENT_TIMESTAMP)
|
785
|
-
.where(oauth_tokens_revoked_at_column => nil)
|
811
|
+
ds.where(Sequel[oauth_tokens_table][oauth_tokens_expires_in_column] >= Sequel::CURRENT_TIMESTAMP)
|
812
|
+
.where(Sequel[oauth_tokens_table][oauth_tokens_revoked_at_column] => nil)
|
813
|
+
end
|
814
|
+
|
815
|
+
def oauth_token_by_token(token)
|
816
|
+
oauth_token_by_token_ds(token).first
|
786
817
|
end
|
787
818
|
|
788
819
|
def oauth_token_by_refresh_token(token, revoked: false)
|
@@ -1103,6 +1134,14 @@ module Rodauth
|
|
1103
1134
|
oauth_tokens_scopes_column => oauth_token[oauth_tokens_scopes_column]
|
1104
1135
|
}
|
1105
1136
|
|
1137
|
+
refresh_token = oauth_unique_id_generator
|
1138
|
+
|
1139
|
+
if oauth_tokens_refresh_token_hash_column
|
1140
|
+
insert_params[oauth_tokens_refresh_token_hash_column] = generate_token_hash(refresh_token)
|
1141
|
+
else
|
1142
|
+
insert_params[oauth_tokens_refresh_token_column] = refresh_token
|
1143
|
+
end
|
1144
|
+
|
1106
1145
|
# revoke the refresh token
|
1107
1146
|
oauth_tokens_ds.where(oauth_tokens_id_column => oauth_token[oauth_tokens_id_column])
|
1108
1147
|
.update(oauth_tokens_revoked_at_column => Sequel::CURRENT_TIMESTAMP)
|
@@ -1116,6 +1155,7 @@ module Rodauth
|
|
1116
1155
|
end
|
1117
1156
|
|
1118
1157
|
oauth_token[oauth_tokens_token_column] = token
|
1158
|
+
oauth_token[oauth_tokens_refresh_token_column] = refresh_token if refresh_token
|
1119
1159
|
oauth_token
|
1120
1160
|
end
|
1121
1161
|
end
|
@@ -1141,7 +1181,8 @@ module Rodauth
|
|
1141
1181
|
scope: token[oauth_tokens_scopes_column],
|
1142
1182
|
client_id: oauth_application[oauth_applications_client_id_column],
|
1143
1183
|
# username
|
1144
|
-
token_type: oauth_token_type
|
1184
|
+
token_type: oauth_token_type,
|
1185
|
+
exp: token[oauth_tokens_expires_in_column].to_i
|
1145
1186
|
}
|
1146
1187
|
end
|
1147
1188
|
|
@@ -33,8 +33,8 @@ module Rodauth
|
|
33
33
|
auth_value_method :oauth_jwt_jwe_copyright, nil
|
34
34
|
auth_value_method :oauth_jwt_audience, nil
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
translatable_method :request_uri_not_supported_message, "request uri is unsupported"
|
37
|
+
translatable_method :invalid_request_object_message, "request object is invalid"
|
38
38
|
|
39
39
|
auth_value_methods(
|
40
40
|
:jwt_encode,
|
@@ -68,7 +68,7 @@ module Rodauth
|
|
68
68
|
auth_value_method :oauth_grants_nonce_column, :nonce
|
69
69
|
auth_value_method :oauth_tokens_nonce_column, :nonce
|
70
70
|
|
71
|
-
|
71
|
+
translatable_method :invalid_scope_message, "The Access Token expired"
|
72
72
|
|
73
73
|
auth_value_method :webfinger_relation, "http://openid.net/specs/connect/1.0/issuer"
|
74
74
|
|
@@ -186,6 +186,8 @@ module Rodauth
|
|
186
186
|
|
187
187
|
def openid_configuration(alt_issuer = nil)
|
188
188
|
request.on(".well-known/openid-configuration") do
|
189
|
+
allow_cors(request)
|
190
|
+
|
189
191
|
request.get do
|
190
192
|
json_response_success(openid_configuration_body(alt_issuer), cache: true)
|
191
193
|
end
|
@@ -493,5 +495,15 @@ module Rodauth
|
|
493
495
|
(val.respond_to?(:empty?) && val.empty?)
|
494
496
|
end
|
495
497
|
end
|
498
|
+
|
499
|
+
def allow_cors(request)
|
500
|
+
return unless request.request_method == "OPTIONS"
|
501
|
+
|
502
|
+
response["Access-Control-Allow-Origin"] = "*"
|
503
|
+
response["Access-Control-Allow-Methods"] = "GET, OPTIONS"
|
504
|
+
response["Access-Control-Max-Age"] = "3600"
|
505
|
+
response.status = 200
|
506
|
+
request.halt
|
507
|
+
end
|
496
508
|
end
|
497
509
|
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
en:
|
2
|
+
rodauth:
|
3
|
+
require_authorization_error_flash: "Please authorize to continue"
|
4
|
+
create_oauth_application_error_flash: "There was an error registering your oauth application"
|
5
|
+
create_oauth_application_notice_flash: "Your oauth application has been registered"
|
6
|
+
revoke_unauthorized_account_error_flash: "You are not authorized to revoke this token"
|
7
|
+
revoke_oauth_token_notice_flash: "The oauth token has been revoked"
|
8
|
+
oauth_authorize_title: "Authorize"
|
9
|
+
oauth_oauth_applications_page_title: "Oauth Applications"
|
10
|
+
oauth_oauth_application_page_title: "Oauth Application"
|
11
|
+
oauth_new_oauth_application_page_title: "New Oauth Application"
|
12
|
+
oauth_oauth_tokens_page_title: "Oauth Tokens"
|
13
|
+
name_label: "Name"
|
14
|
+
description_label: "Description"
|
15
|
+
scopes_label: "Scopes"
|
16
|
+
homepage_url_label: "Homepage URL"
|
17
|
+
redirect_uri_label: "Redirect URL"
|
18
|
+
client_secret_label: "Client Secret"
|
19
|
+
client_id_label: "Client ID"
|
20
|
+
oauth_applications_button: "Register"
|
21
|
+
oauth_authorize_button: "Authorize"
|
22
|
+
oauth_token_revoke_button: "Revoke"
|
23
|
+
oauth_authorize_post_button: "Back to Client Application"
|
24
|
+
invalid_grant_message: "Invalid grant"
|
25
|
+
invalid_scope_message: "Invalid scope"
|
26
|
+
invalid_url_message: "Invalid URL"
|
27
|
+
unsupported_token_type_message: "Invalid token type hint"
|
28
|
+
unique_error_message: "is already in use"
|
29
|
+
null_error_message: "is not filled"
|
30
|
+
already_in_use_message: "error generating unique token"
|
31
|
+
code_challenge_required_message: "code challenge required"
|
32
|
+
unsupported_transform_algorithm_message: "transform algorithm not supported"
|
33
|
+
request_uri_not_supported_message: "request uri is unsupported"
|
34
|
+
invalid_request_object_message: "request object is invalid"
|
35
|
+
invalid_scope_message: "The Access Token expired"
|
data/templates/authorize.str
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<form method="post" class="form-horizontal" role="form" id="authorize-form">
|
1
|
+
<form method="post" action="#{rodauth.authorize_path}" class="form-horizontal" role="form" id="authorize-form">
|
2
2
|
#{csrf_tag(rodauth.authorize_path) if respond_to?(:csrf_tag)}
|
3
3
|
<p class="lead">The application #{rodauth.oauth_application[rodauth.oauth_applications_name_column]} would like to access your data.</p>
|
4
4
|
|
@@ -7,12 +7,22 @@
|
|
7
7
|
|
8
8
|
#{
|
9
9
|
rodauth.scopes.map do |scope|
|
10
|
-
|
11
|
-
|
12
|
-
<
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
if scope == rodauth.oauth_application_default_scope
|
11
|
+
<<-HTML
|
12
|
+
<div class="form-check">
|
13
|
+
<input id="#{scope}" class="form-check-input" type="checkbox" name="scope[]" value="#{scope}" checked disabled>
|
14
|
+
<label class="form-check-label" for="#{scope}">#{scope}</label>
|
15
|
+
<input type="hidden" name="scope[]" value="#{scope}">
|
16
|
+
</div>
|
17
|
+
HTML
|
18
|
+
else
|
19
|
+
<<-HTML
|
20
|
+
<div class="form-check">
|
21
|
+
<input id="#{scope}" class="form-check-input" type="checkbox" name="scope[]" value="#{scope}">
|
22
|
+
<label class="form-check-label" for="#{scope}">#{scope}</label>
|
23
|
+
</div>
|
24
|
+
HTML
|
25
|
+
end
|
16
26
|
end.join
|
17
27
|
}
|
18
28
|
|
@@ -31,4 +41,4 @@
|
|
31
41
|
<input type="submit" class="btn btn-outline-primary" value="#{h(rodauth.oauth_authorize_button)}"/>
|
32
42
|
<a href="#{rodauth.redirect_uri}?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request#{ "&state=#{rodauth.param("state")}" if rodauth.param_or_nil("state")}" class="btn btn-outline-danger">Cancel</a>
|
33
43
|
</p>
|
34
|
-
</form>
|
44
|
+
</form>
|
@@ -7,5 +7,5 @@
|
|
7
7
|
end.join
|
8
8
|
}
|
9
9
|
</dl>
|
10
|
-
<a href="
|
11
|
-
</div>
|
10
|
+
<a href="#{rodauth.oauth_applications_path}/#{@oauth_application[:id]}/#{rodauth.oauth_tokens_path}" class="btn btn-outline-secondary">Oauth Tokens</a>
|
11
|
+
</div>
|
data/templates/oauth_tokens.str
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
<th scope="col">Token</th>
|
11
11
|
<th scope="col">Refresh Token</th>
|
12
12
|
<th scope="col">Expires in</th>
|
13
|
-
<th scope="col">
|
13
|
+
<th scope="col">Revoked at</th>
|
14
|
+
<th scope="col">Scopes</th>
|
14
15
|
<th scope="col"><span class="badge badge-pill badge-dark">#{@oauth_tokens.count}</span>
|
15
16
|
</tr>
|
16
17
|
</thead>
|
@@ -19,16 +20,17 @@
|
|
19
20
|
@oauth_tokens.map do |oauth_token|
|
20
21
|
<<-HTML
|
21
22
|
<tr>
|
22
|
-
<td>#{oauth_token[rodauth.oauth_tokens_token_column]}</td>
|
23
|
-
<td>#{oauth_token[rodauth.oauth_tokens_refresh_token_column]}</td>
|
24
|
-
<td>#{
|
25
|
-
<td>#{
|
23
|
+
<td><code class="token">#{oauth_token[rodauth.oauth_tokens_token_column]}</code></td>
|
24
|
+
<td><code class="token">#{oauth_token[rodauth.oauth_tokens_refresh_token_column]}</code></td>
|
25
|
+
<td>#{oauth_token[rodauth.oauth_tokens_expires_in_column]}</td>
|
26
|
+
<td>#{oauth_token[rodauth.oauth_tokens_revoked_at_column]}</td>
|
27
|
+
<td>#{oauth_token[rodauth.oauth_tokens_scopes_column]}</td>
|
26
28
|
<td>
|
27
29
|
#{
|
28
|
-
if !oauth_token[rodauth.
|
30
|
+
if !oauth_token[rodauth.oauth_tokens_revoked_at_column] && !oauth_token[rodauth.oauth_tokens_token_hash_column]
|
29
31
|
<<-HTML
|
30
32
|
<form method="post" action="#{rodauth.revoke_path}" class="form-horizontal" role="form" id="revoke-form">
|
31
|
-
#{csrf_tag(rodauth.
|
33
|
+
#{csrf_tag(rodauth.revoke_path) if respond_to?(:csrf_tag)}
|
32
34
|
#{rodauth.input_field_string("token_type_hint", "revoke-token-type-hint", :value => "access_token", :type=>"hidden")}
|
33
35
|
#{rodauth.input_field_string("token", "revoke-token", :value => oauth_token[rodauth.oauth_tokens_token_column], :type=>"hidden")}
|
34
36
|
#{rodauth.button(rodauth.oauth_token_revoke_button)}
|
@@ -46,4 +48,4 @@
|
|
46
48
|
HTML
|
47
49
|
end
|
48
50
|
}
|
49
|
-
</div>
|
51
|
+
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Implementation of the OAuth 2.0 protocol on top of rodauth.
|
14
14
|
email:
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/rodauth/oauth/railtie.rb
|
40
40
|
- lib/rodauth/oauth/ttl_store.rb
|
41
41
|
- lib/rodauth/oauth/version.rb
|
42
|
+
- locales/en.yml
|
42
43
|
- templates/authorize.str
|
43
44
|
- templates/client_secret_field.str
|
44
45
|
- templates/description_field.str
|
@@ -51,7 +52,8 @@ files:
|
|
51
52
|
- templates/redirect_uri_field.str
|
52
53
|
- templates/scope_field.str
|
53
54
|
homepage: https://gitlab.com/honeyryderchuck/rodauth-oauth
|
54
|
-
licenses:
|
55
|
+
licenses:
|
56
|
+
- Apache 2.0
|
55
57
|
metadata:
|
56
58
|
homepage_uri: https://gitlab.com/honeyryderchuck/rodauth-oauth
|
57
59
|
source_code_uri: https://gitlab.com/honeyryderchuck/rodauth-oauth
|
@@ -71,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
73
|
- !ruby/object:Gem::Version
|
72
74
|
version: '0'
|
73
75
|
requirements: []
|
74
|
-
rubygems_version: 3.2.
|
76
|
+
rubygems_version: 3.2.22
|
75
77
|
signing_key:
|
76
78
|
specification_version: 4
|
77
79
|
summary: Implementation of the OAuth 2.0 protocol on top of rodauth.
|