rodauth-oauth 0.6.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0c72cd872103e1d10929ad5934312a123a42b3c9cb55c06c118fbcb0d83f4a7
4
- data.tar.gz: 57bbcef2981c20627cfc9239b30781af03898e34b5d2861b84a820d778e1dac3
3
+ metadata.gz: bcd4bc063c53c65c932bb24bf9c162aa97a24dd2c21b900cc96580d2ded0ef9e
4
+ data.tar.gz: fce8657cfa50710842dc72d221d01fdc27e7383c9923ad1e6f1408a82df75ad2
5
5
  SHA512:
6
- metadata.gz: a4c48e1ce93074c5dff85f506c8c5b8c7f024409f9c58ae942bb2adb5241303586cb0930a1c849566c793d6d9e508a73b0f5fc5772a82e3c87852415997e7889
7
- data.tar.gz: 54e5777b2506ea99f830cd3d9b66ca1755372681cd19013638bc25680b0ce601275fb5fd732b123fcefddb7f56ba0ac1fc6a069f028c377be5a7408d92debb9e
6
+ metadata.gz: 38069bd184dcc884b3155707144ae33a16a40ed59c2d62fe4fe74f6a5b3eaff4861bf76fbabaf86c879a04512c8ae8704d0e07c9a44d0aee531429067574ce59
7
+ data.tar.gz: 55e14d2f55d4a12be3299eafe0c1878788d87d788acf35968af67f85426453bdd86bc36390cadf3ea5ae7c03b5549a893c704626631bb32c2489199e7de3baa2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,71 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ### 0.7.3 (14/01/2021)
6
+
7
+ #### Bugfixes
8
+
9
+ * fixed generator declarations and views generator, in orderto copy templates and rewrite paths accordingly.
10
+ * update view templates to not use "%%".
11
+
12
+ #### Chore
13
+
14
+ * `rodauth` is now declared as a dependency, with minimum version set `2.0`.
15
+
16
+ ### 0.7.2 (14/12/2021)
17
+
18
+ #### Features
19
+
20
+ * Revoking tokens from the OAuth Application management interface (@muellerj)
21
+
22
+ 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).
23
+
24
+ #### Bugfixes
25
+
26
+ Default scope usage related bugfixes:
27
+
28
+ * Improved default scope conversion to avoid nested arrays (@muellerj);
29
+ * Authorize form shows a disabled checkbox and POST's no scope when default scope is to be used (@muellerj);
30
+ * example default scope fixed for example authorization server (should be string) (@muellerj);
31
+ * several param fixes in view templates (@muellerj);
32
+
33
+ OAuth Applications Management fixes:
34
+
35
+ * Access to OAuth Application page is now restricted to app owner;
36
+ * OAuth Applications page now lists the **only** the applications owned by the logged in user;
37
+
38
+ ### 0.7.1 (05/12/2021)
39
+
40
+ #### Improvements
41
+
42
+ * Adapted the `rodauth-i18n` configuration to comply with the guidelines for `v0.2.0` (which is the defacto minimmal supported version).
43
+
44
+ #### Bugfixes
45
+
46
+ * `convert_timestamp` was removed from the templates, as it's private API.
47
+ * Several missing or wrong URLs in templates fixed (authorize form was wrongly processing scopes when none was selected).
48
+
49
+ ### 0.7.0 (02/12/2021)
50
+
51
+ #### Features
52
+
53
+ * Internationalization (i18n) support by hooking on [rodauth-i18n](https://github.com/janko/rodauth-i18n).
54
+ * Sets all text using `translatable_method`.
55
+ * Provides english translations for all `rodauth-oauth` related user facing text.
56
+
57
+ #### Improvements
58
+
59
+ * Enable CORS requests for OpenID configuration endpoint (@ianks)
60
+ * Introspect endpoint now exposes the `exp` token property (@gmanley)
61
+
62
+ #### Bugfixes
63
+
64
+ * 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)
65
+
66
+ #### Chore
67
+
68
+ Setting `rodauth` minimal supported version to `2.0.0`.
69
+
5
70
  ### 0.6.1 (08/09/2021)
6
71
 
7
72
  #### Bugfixes
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 idenntity 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:
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
-
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rails/generators/base"
3
+ require "rails/generators"
4
4
  require "rails/generators/migration"
5
5
  require "rails/generators/active_record"
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rails/generators/base"
3
+ require "rails/generators"
4
4
 
5
5
  module Rodauth::OAuth
6
6
  module Rails
@@ -8,6 +8,7 @@ module Rodauth::OAuth
8
8
  class ViewsGenerator < ::Rails::Generators::Base
9
9
  source_root "#{__dir__}/templates"
10
10
  namespace "rodauth:oauth:views"
11
+ desc "Generate db migrations for rodauth-oauth in your application."
11
12
 
12
13
  DEFAULT = %w[authorize].freeze
13
14
  VIEWS = {
@@ -31,16 +32,20 @@ module Rodauth::OAuth
31
32
  default: "rodauth"
32
33
 
33
34
  def create_views
34
- features = options[:all] ? VIEWS.keys : (DEFAULT + options[:features]).map(&:to_sym)
35
+ features = options[:all] ? VIEWS.keys : (%i[oauth_authorize] + options[:features]).map(&:to_sym).uniq
35
36
 
36
37
  views = features.inject([]) do |list, feature|
37
38
  list |= VIEWS[feature] || []
38
39
  list |= VIEWS[DEPENDENCIES[feature]] || []
39
40
  end
40
41
 
42
+ directory = options[:directory].underscore
41
43
  views.each do |view|
42
- template "app/views/rodauth/#{view}.html.erb",
43
- "app/views/#{options[:directory].underscore}/#{view}.html.erb"
44
+ copy_file "app/views/rodauth/#{view}.html.erb",
45
+ "app/views/#{directory}/#{view}.html.erb" do |content|
46
+ content = content.gsub("rodauth/", "#{directory}/")
47
+ content
48
+ end
44
49
  end
45
50
  end
46
51
  end
@@ -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
- auth_value_method :invalid_client_message, "Invalid client"
172
- auth_value_method :invalid_grant_type_message, "Invalid grant type"
173
- auth_value_method :invalid_grant_message, "Invalid grant"
174
- auth_value_method :invalid_scope_message, "Invalid scope"
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
- auth_value_method :invalid_url_message, "Invalid URL"
177
- auth_value_method :unsupported_token_type_message, "Invalid token type hint"
177
+ translatable_method :invalid_url_message, "Invalid URL"
178
+ translatable_method :unsupported_token_type_message, "Invalid token type hint"
178
179
 
179
- auth_value_method :unique_error_message, "is already in use"
180
- auth_value_method :null_error_message, "is not filled"
181
- auth_value_method :already_in_use_message, "error generating unique token"
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
- auth_value_method :code_challenge_required_message, "code challenge required"
187
+ translatable_method :code_challenge_required_message, "code challenge required"
187
188
  auth_value_method :unsupported_transform_algorithm_error_code, "invalid_request"
188
- auth_value_method :unsupported_transform_algorithm_message, "transform algorithm not supported"
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
- require_oauth_application
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].where(oauth_applications_id_column => id).first
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
- [oauth_application_default_scope]
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 oauth_token_by_token(token)
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).first
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
- auth_value_method :request_uri_not_supported_message, "request uri is unsupported"
37
- auth_value_method :invalid_request_object_message, "request object is invalid"
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
- auth_value_method :invalid_scope_message, "The Access Token expired"
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rodauth
4
4
  module OAuth
5
- VERSION = "0.6.1"
5
+ VERSION = "0.7.3"
6
6
  end
7
7
  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"
@@ -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
- <<-HTML
11
- <div class="form-check">
12
- <input id="#{scope}" class="form-check-input" type="checkbox" name="scope[]" value="#{scope}" #{"checked disabled" if scope == rodauth.oauth_application_default_scope}>
13
- <label class="form-check-label" for="#{scope}">#{scope}</label>
14
- </div>
15
- HTML
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="/#{"#{rodauth.oauth_applications_path}/#{@oauth_application[:id]}/#{rodauth.oauth_tokens_path}"}" class="btn btn-outline-secondary">Oauth Tokens</a>
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>
@@ -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">Revoke</th>
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>#{rodauth.convert_timestamp(oauth_token[rodauth.oauth_tokens_expires_in_column])}</td>
25
- <td>#{rodauth.convert_timestamp(oauth_token[rodauth.oauth_tokens_revoked_at_column])}</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.oauth_tokens_revoked_at_param] && !oauth_token[rodauth.oauth_tokens_token_hash_column]
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.oauth_revoke_path) if respond_to?(:csrf_tag)}
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,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.3
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-09-08 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rodauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
13
27
  description: Implementation of the OAuth 2.0 protocol on top of rodauth.
14
28
  email:
15
29
  - cardoso_tiago@hotmail.com
@@ -39,6 +53,7 @@ files:
39
53
  - lib/rodauth/oauth/railtie.rb
40
54
  - lib/rodauth/oauth/ttl_store.rb
41
55
  - lib/rodauth/oauth/version.rb
56
+ - locales/en.yml
42
57
  - templates/authorize.str
43
58
  - templates/client_secret_field.str
44
59
  - templates/description_field.str
@@ -51,11 +66,15 @@ files:
51
66
  - templates/redirect_uri_field.str
52
67
  - templates/scope_field.str
53
68
  homepage: https://gitlab.com/honeyryderchuck/rodauth-oauth
54
- licenses: []
69
+ licenses:
70
+ - Apache 2.0
55
71
  metadata:
56
- homepage_uri: https://gitlab.com/honeyryderchuck/rodauth-oauth
72
+ homepage_uri: https://honeyryderchuck.gitlab.io/rodauth-oauth/
73
+ documentation_uri: https://honeyryderchuck.gitlab.io/rodauth-oauth/rdoc/
74
+ bug_tracker_uri: https://gitlab.com/honeyryderchuck/rodauth-oauth/issues
57
75
  source_code_uri: https://gitlab.com/honeyryderchuck/rodauth-oauth
58
76
  changelog_uri: https://gitlab.com/honeyryderchuck/rodauth-oauth/-/blob/master/CHANGELOG.md
77
+ rubygems_mfa_required: 'true'
59
78
  post_install_message:
60
79
  rdoc_options: []
61
80
  require_paths:
@@ -71,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
90
  - !ruby/object:Gem::Version
72
91
  version: '0'
73
92
  requirements: []
74
- rubygems_version: 3.2.15
93
+ rubygems_version: 3.2.32
75
94
  signing_key:
76
95
  specification_version: 4
77
96
  summary: Implementation of the OAuth 2.0 protocol on top of rodauth.