rodauth-oauth 0.7.4 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -424
  3. data/README.md +30 -390
  4. data/doc/release_notes/0_0_1.md +3 -0
  5. data/doc/release_notes/0_0_2.md +15 -0
  6. data/doc/release_notes/0_0_3.md +31 -0
  7. data/doc/release_notes/0_0_4.md +36 -0
  8. data/doc/release_notes/0_0_5.md +36 -0
  9. data/doc/release_notes/0_0_6.md +21 -0
  10. data/doc/release_notes/0_1_0.md +44 -0
  11. data/doc/release_notes/0_2_0.md +43 -0
  12. data/doc/release_notes/0_3_0.md +28 -0
  13. data/doc/release_notes/0_4_0.md +18 -0
  14. data/doc/release_notes/0_4_1.md +9 -0
  15. data/doc/release_notes/0_4_2.md +5 -0
  16. data/doc/release_notes/0_4_3.md +3 -0
  17. data/doc/release_notes/0_5_0.md +11 -0
  18. data/doc/release_notes/0_5_1.md +13 -0
  19. data/doc/release_notes/0_6_0.md +9 -0
  20. data/doc/release_notes/0_6_1.md +6 -0
  21. data/doc/release_notes/0_7_0.md +20 -0
  22. data/doc/release_notes/0_7_1.md +10 -0
  23. data/doc/release_notes/0_7_2.md +21 -0
  24. data/doc/release_notes/0_7_3.md +10 -0
  25. data/doc/release_notes/0_7_4.md +5 -0
  26. data/doc/release_notes/0_8_0.md +37 -0
  27. data/doc/release_notes/0_9_0.md +56 -0
  28. data/doc/release_notes/0_9_1.md +9 -0
  29. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/authorize.html.erb +25 -4
  30. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/device_search.html.erb +11 -0
  31. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/device_verification.html.erb +20 -0
  32. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/new_oauth_application.html.erb +27 -10
  33. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application.html.erb +17 -5
  34. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application_oauth_tokens.html.erb +39 -0
  35. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_applications.html.erb +6 -5
  36. data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_tokens.html.erb +12 -15
  37. data/lib/generators/rodauth/oauth/templates/db/migrate/create_rodauth_oauth.rb +21 -1
  38. data/lib/rodauth/features/oauth.rb +3 -1418
  39. data/lib/rodauth/features/oauth_application_management.rb +225 -0
  40. data/lib/rodauth/features/oauth_assertion_base.rb +96 -0
  41. data/lib/rodauth/features/oauth_authorization_code_grant.rb +252 -0
  42. data/lib/rodauth/features/oauth_authorization_server.rb +0 -0
  43. data/lib/rodauth/features/oauth_base.rb +778 -0
  44. data/lib/rodauth/features/oauth_client_credentials_grant.rb +33 -0
  45. data/lib/rodauth/features/oauth_device_grant.rb +220 -0
  46. data/lib/rodauth/features/oauth_dynamic_client_registration.rb +252 -0
  47. data/lib/rodauth/features/oauth_http_mac.rb +3 -21
  48. data/lib/rodauth/features/oauth_implicit_grant.rb +59 -0
  49. data/lib/rodauth/features/oauth_jwt.rb +275 -100
  50. data/lib/rodauth/features/oauth_jwt_bearer_grant.rb +59 -0
  51. data/lib/rodauth/features/oauth_management_base.rb +68 -0
  52. data/lib/rodauth/features/oauth_pkce.rb +98 -0
  53. data/lib/rodauth/features/oauth_resource_server.rb +21 -0
  54. data/lib/rodauth/features/oauth_saml_bearer_grant.rb +102 -0
  55. data/lib/rodauth/features/oauth_token_introspection.rb +108 -0
  56. data/lib/rodauth/features/oauth_token_management.rb +79 -0
  57. data/lib/rodauth/features/oauth_token_revocation.rb +109 -0
  58. data/lib/rodauth/features/oidc.rb +38 -9
  59. data/lib/rodauth/features/oidc_dynamic_client_registration.rb +147 -0
  60. data/lib/rodauth/oauth/database_extensions.rb +15 -2
  61. data/lib/rodauth/oauth/jwe_extensions.rb +64 -0
  62. data/lib/rodauth/oauth/refinements.rb +48 -0
  63. data/lib/rodauth/oauth/ttl_store.rb +9 -3
  64. data/lib/rodauth/oauth/version.rb +1 -1
  65. data/locales/en.yml +33 -12
  66. data/templates/authorize.str +57 -8
  67. data/templates/client_secret_field.str +2 -2
  68. data/templates/description_field.str +1 -1
  69. data/templates/device_search.str +11 -0
  70. data/templates/device_verification.str +24 -0
  71. data/templates/homepage_url_field.str +2 -2
  72. data/templates/jwks_field.str +4 -0
  73. data/templates/jwt_public_key_field.str +4 -0
  74. data/templates/name_field.str +1 -1
  75. data/templates/new_oauth_application.str +9 -0
  76. data/templates/oauth_application.str +7 -3
  77. data/templates/oauth_application_oauth_tokens.str +52 -0
  78. data/templates/oauth_applications.str +3 -2
  79. data/templates/oauth_tokens.str +10 -11
  80. data/templates/redirect_uri_field.str +2 -2
  81. metadata +80 -3
  82. data/lib/rodauth/features/oauth_saml.rb +0 -104
@@ -0,0 +1,52 @@
1
+ <div id="oauth-tokens">
2
+ #{
3
+ if @oauth_tokens.count.zero?
4
+ "<p>No oauth tokens yet!</p>"
5
+ else
6
+ <<-HTML
7
+ <table class="table">
8
+ <thead>
9
+ <tr>
10
+ <th scope="col">#{rodauth.oauth_tokens_token_label}</th>
11
+ <th scope="col">#{rodauth.oauth_tokens_refresh_token_label}</th>
12
+ <th scope="col">#{rodauth.oauth_tokens_expires_in_label}</th>
13
+ <th scope="col">#{rodauth.oauth_tokens_revoked_at_label}</th>
14
+ <th scope="col">#{rodauth.oauth_tokens_scopes_label}</th>
15
+ <th scope="col"><span class="badge badge-pill badge-dark">#{@oauth_tokens.count}</span>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ #{
20
+ @oauth_tokens.map do |oauth_token|
21
+ <<-HTML
22
+ <tr>
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>
28
+ <td>
29
+ #{
30
+ if !oauth_token[rodauth.oauth_tokens_revoked_at_column] && !oauth_token[rodauth.oauth_tokens_token_hash_column]
31
+ <<-HTML
32
+ <form method="post" action="#{rodauth.revoke_path}" class="form-horizontal" role="form" id="revoke-form">
33
+ #{csrf_tag(rodauth.revoke_path) if respond_to?(:csrf_tag)}
34
+ #{rodauth.input_field_string("token_type_hint", "revoke-token-type-hint", :value => "access_token", :type=>"hidden")}
35
+ #{rodauth.input_field_string("token", "revoke-token", :value => oauth_token[rodauth.oauth_tokens_token_column], :type=>"hidden")}
36
+ #{rodauth.button(rodauth.oauth_token_revoke_button)}
37
+ </form>
38
+ HTML
39
+ end
40
+ }
41
+ </td>
42
+ </tr>
43
+ HTML
44
+ end.join
45
+ }
46
+ </tbody>
47
+ </table>
48
+ #{rodauth.oauth_management_pagination_links(@oauth_tokens)}
49
+ HTML
50
+ end
51
+ }
52
+ </div>
@@ -1,14 +1,15 @@
1
1
  <div id="oauth-applications">
2
- <a class="btn btn-outline-primary" href="/oauth-applications/new">Register new Oauth Application</a>
2
+ <a class="btn btn-outline-primary" href="/oauth-applications/new">#{rodauth.new_oauth_application_page_title}</a>
3
3
  #{
4
4
  if @oauth_applications.count.zero?
5
5
  "<p>No oauth applications yet!</p>"
6
6
  else
7
- "<ul class=\"list-group\">" +
7
+ "<ul class=\"list-group\">" +
8
8
  @oauth_applications.map do |application|
9
9
  "<li class=\"list-group-item\"><a href=\"/oauth-applications/#{application[:id]}\">#{application[:name]}</a></li>"
10
10
  end.join +
11
11
  "</ul>"
12
12
  end
13
13
  }
14
+ #{rodauth.oauth_management_pagination_links(@oauth_applications)}
14
15
  </div>
@@ -7,11 +7,11 @@
7
7
  <table class="table">
8
8
  <thead>
9
9
  <tr>
10
- <th scope="col">Token</th>
11
- <th scope="col">Refresh Token</th>
12
- <th scope="col">Expires in</th>
13
- <th scope="col">Revoked at</th>
14
- <th scope="col">Scopes</th>
10
+ <th scope="col">#{rodauth.oauth_applications_name_label}</th>
11
+ <th scope="col">#{rodauth.oauth_tokens_token_label}</th>
12
+ <th scope="col">#{rodauth.oauth_tokens_refresh_token_label}</th>
13
+ <th scope="col">#{rodauth.oauth_tokens_expires_in_label}</th>
14
+ <th scope="col">#{rodauth.oauth_tokens_scopes_label}</th>
15
15
  <th scope="col"><span class="badge badge-pill badge-dark">#{@oauth_tokens.count}</span>
16
16
  </tr>
17
17
  </thead>
@@ -20,19 +20,17 @@
20
20
  @oauth_tokens.map do |oauth_token|
21
21
  <<-HTML
22
22
  <tr>
23
+ <td>#{oauth_token[rodauth.oauth_applications_name_column]}</td>
23
24
  <td><code class="token">#{oauth_token[rodauth.oauth_tokens_token_column]}</code></td>
24
25
  <td><code class="token">#{oauth_token[rodauth.oauth_tokens_refresh_token_column]}</code></td>
25
26
  <td>#{oauth_token[rodauth.oauth_tokens_expires_in_column]}</td>
26
- <td>#{oauth_token[rodauth.oauth_tokens_revoked_at_column]}</td>
27
27
  <td>#{oauth_token[rodauth.oauth_tokens_scopes_column]}</td>
28
28
  <td>
29
29
  #{
30
- if !oauth_token[rodauth.oauth_tokens_revoked_at_column] && !oauth_token[rodauth.oauth_tokens_token_hash_column]
30
+ if !oauth_token[rodauth.oauth_tokens_token_hash_column]
31
31
  <<-HTML
32
- <form method="post" action="#{rodauth.revoke_path}" class="form-horizontal" role="form" id="revoke-form">
33
- #{csrf_tag(rodauth.revoke_path) if respond_to?(:csrf_tag)}
34
- #{rodauth.input_field_string("token_type_hint", "revoke-token-type-hint", :value => "access_token", :type=>"hidden")}
35
- #{rodauth.input_field_string("token", "revoke-token", :value => oauth_token[rodauth.oauth_tokens_token_column], :type=>"hidden")}
32
+ <form method="post" action="#{rodauth.oauth_token_path(oauth_token[rodauth.oauth_tokens_id_column])}" class="form-horizontal" role="form" id="token-revoke-form">
33
+ #{csrf_tag(rodauth.oauth_token_path(oauth_token[rodauth.oauth_tokens_id_column])) if respond_to?(:csrf_tag)}
36
34
  #{rodauth.button(rodauth.oauth_token_revoke_button)}
37
35
  </form>
38
36
  HTML
@@ -45,6 +43,7 @@
45
43
  }
46
44
  </tbody>
47
45
  </table>
46
+ #{rodauth.oauth_management_pagination_links(@oauth_tokens)}
48
47
  HTML
49
48
  end
50
49
  }
@@ -1,4 +1,4 @@
1
1
  <div class="form-group">
2
- <label for="redirect_uri">#{rodauth.redirect_uri_label}#{rodauth.input_field_label_suffix}</label>
3
- #{rodauth.input_field_string(rodauth.oauth_application_redirect_uri_param, "redirect_uri", :type=>"text")}
2
+ <label for="redirect_uri">#{rodauth.oauth_applications_redirect_uri_label}#{rodauth.input_field_label_suffix}</label>
3
+ #{rodauth.input_field_string(rodauth.oauth_application_redirect_uri_param, "redirect-uri", :type=>"text")}
4
4
  </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.7.4
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-14 00:00:00.000000000 Z
11
+ date: 2022-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rodauth
@@ -33,39 +33,116 @@ extra_rdoc_files:
33
33
  - LICENSE.txt
34
34
  - README.md
35
35
  - CHANGELOG.md
36
+ - doc/release_notes/0_0_1.md
37
+ - doc/release_notes/0_0_2.md
38
+ - doc/release_notes/0_0_3.md
39
+ - doc/release_notes/0_0_4.md
40
+ - doc/release_notes/0_0_5.md
41
+ - doc/release_notes/0_0_6.md
42
+ - doc/release_notes/0_1_0.md
43
+ - doc/release_notes/0_2_0.md
44
+ - doc/release_notes/0_3_0.md
45
+ - doc/release_notes/0_4_0.md
46
+ - doc/release_notes/0_4_1.md
47
+ - doc/release_notes/0_4_2.md
48
+ - doc/release_notes/0_4_3.md
49
+ - doc/release_notes/0_5_0.md
50
+ - doc/release_notes/0_5_1.md
51
+ - doc/release_notes/0_6_0.md
52
+ - doc/release_notes/0_6_1.md
53
+ - doc/release_notes/0_7_0.md
54
+ - doc/release_notes/0_7_1.md
55
+ - doc/release_notes/0_7_2.md
56
+ - doc/release_notes/0_7_3.md
57
+ - doc/release_notes/0_7_4.md
58
+ - doc/release_notes/0_8_0.md
59
+ - doc/release_notes/0_9_0.md
60
+ - doc/release_notes/0_9_1.md
36
61
  files:
37
62
  - CHANGELOG.md
38
63
  - LICENSE.txt
39
64
  - README.md
65
+ - doc/release_notes/0_0_1.md
66
+ - doc/release_notes/0_0_2.md
67
+ - doc/release_notes/0_0_3.md
68
+ - doc/release_notes/0_0_4.md
69
+ - doc/release_notes/0_0_5.md
70
+ - doc/release_notes/0_0_6.md
71
+ - doc/release_notes/0_1_0.md
72
+ - doc/release_notes/0_2_0.md
73
+ - doc/release_notes/0_3_0.md
74
+ - doc/release_notes/0_4_0.md
75
+ - doc/release_notes/0_4_1.md
76
+ - doc/release_notes/0_4_2.md
77
+ - doc/release_notes/0_4_3.md
78
+ - doc/release_notes/0_5_0.md
79
+ - doc/release_notes/0_5_1.md
80
+ - doc/release_notes/0_6_0.md
81
+ - doc/release_notes/0_6_1.md
82
+ - doc/release_notes/0_7_0.md
83
+ - doc/release_notes/0_7_1.md
84
+ - doc/release_notes/0_7_2.md
85
+ - doc/release_notes/0_7_3.md
86
+ - doc/release_notes/0_7_4.md
87
+ - doc/release_notes/0_8_0.md
88
+ - doc/release_notes/0_9_0.md
89
+ - doc/release_notes/0_9_1.md
40
90
  - lib/generators/rodauth/oauth/install_generator.rb
41
91
  - lib/generators/rodauth/oauth/templates/app/models/oauth_application.rb
42
92
  - lib/generators/rodauth/oauth/templates/app/models/oauth_grant.rb
43
93
  - lib/generators/rodauth/oauth/templates/app/models/oauth_token.rb
44
94
  - lib/generators/rodauth/oauth/templates/app/views/rodauth/authorize.html.erb
95
+ - lib/generators/rodauth/oauth/templates/app/views/rodauth/device_search.html.erb
96
+ - lib/generators/rodauth/oauth/templates/app/views/rodauth/device_verification.html.erb
45
97
  - lib/generators/rodauth/oauth/templates/app/views/rodauth/new_oauth_application.html.erb
46
98
  - lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application.html.erb
99
+ - lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application_oauth_tokens.html.erb
47
100
  - lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_applications.html.erb
48
101
  - lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_tokens.html.erb
49
102
  - lib/generators/rodauth/oauth/templates/db/migrate/create_rodauth_oauth.rb
50
103
  - lib/generators/rodauth/oauth/views_generator.rb
51
104
  - lib/rodauth/features/oauth.rb
105
+ - lib/rodauth/features/oauth_application_management.rb
106
+ - lib/rodauth/features/oauth_assertion_base.rb
107
+ - lib/rodauth/features/oauth_authorization_code_grant.rb
108
+ - lib/rodauth/features/oauth_authorization_server.rb
109
+ - lib/rodauth/features/oauth_base.rb
110
+ - lib/rodauth/features/oauth_client_credentials_grant.rb
111
+ - lib/rodauth/features/oauth_device_grant.rb
112
+ - lib/rodauth/features/oauth_dynamic_client_registration.rb
52
113
  - lib/rodauth/features/oauth_http_mac.rb
114
+ - lib/rodauth/features/oauth_implicit_grant.rb
53
115
  - lib/rodauth/features/oauth_jwt.rb
54
- - lib/rodauth/features/oauth_saml.rb
116
+ - lib/rodauth/features/oauth_jwt_bearer_grant.rb
117
+ - lib/rodauth/features/oauth_management_base.rb
118
+ - lib/rodauth/features/oauth_pkce.rb
119
+ - lib/rodauth/features/oauth_resource_server.rb
120
+ - lib/rodauth/features/oauth_saml_bearer_grant.rb
121
+ - lib/rodauth/features/oauth_token_introspection.rb
122
+ - lib/rodauth/features/oauth_token_management.rb
123
+ - lib/rodauth/features/oauth_token_revocation.rb
55
124
  - lib/rodauth/features/oidc.rb
125
+ - lib/rodauth/features/oidc_dynamic_client_registration.rb
56
126
  - lib/rodauth/oauth.rb
57
127
  - lib/rodauth/oauth/database_extensions.rb
128
+ - lib/rodauth/oauth/jwe_extensions.rb
58
129
  - lib/rodauth/oauth/railtie.rb
130
+ - lib/rodauth/oauth/refinements.rb
59
131
  - lib/rodauth/oauth/ttl_store.rb
60
132
  - lib/rodauth/oauth/version.rb
61
133
  - locales/en.yml
62
134
  - templates/authorize.str
63
135
  - templates/client_secret_field.str
64
136
  - templates/description_field.str
137
+ - templates/device_search.str
138
+ - templates/device_verification.str
65
139
  - templates/homepage_url_field.str
140
+ - templates/jwks_field.str
141
+ - templates/jwt_public_key_field.str
66
142
  - templates/name_field.str
67
143
  - templates/new_oauth_application.str
68
144
  - templates/oauth_application.str
145
+ - templates/oauth_application_oauth_tokens.str
69
146
  - templates/oauth_applications.str
70
147
  - templates/oauth_tokens.str
71
148
  - templates/redirect_uri_field.str
@@ -1,104 +0,0 @@
1
- # frozen-string-literal: true
2
-
3
- require "onelogin/ruby-saml"
4
-
5
- module Rodauth
6
- Feature.define(:oauth_saml, :OauthSaml) do
7
- depends :oauth
8
-
9
- auth_value_method :oauth_saml_cert_fingerprint, "9E:65:2E:03:06:8D:80:F2:86:C7:6C:77:A1:D9:14:97:0A:4D:F4:4D"
10
- auth_value_method :oauth_saml_cert_fingerprint_algorithm, nil
11
- auth_value_method :oauth_saml_name_identifier_format, "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
12
-
13
- auth_value_method :oauth_saml_security_authn_requests_signed, false
14
- auth_value_method :oauth_saml_security_metadata_signed, false
15
- auth_value_method :oauth_saml_security_digest_method, XMLSecurity::Document::SHA1
16
- auth_value_method :oauth_saml_security_signature_method, XMLSecurity::Document::RSA_SHA1
17
-
18
- SAML_GRANT_TYPE = "http://oauth.net/grant_type/assertion/saml/2.0/bearer"
19
-
20
- # /token
21
-
22
- def require_oauth_application
23
- # requset authentication optional for assertions
24
- return super unless param("grant_type") == SAML_GRANT_TYPE && !param_or_nil("client_id")
25
-
26
- # TODO: invalid grant
27
- authorization_required unless saml_assertion
28
-
29
- redirect_uri = saml_assertion.destination
30
-
31
- @oauth_application = db[oauth_applications_table].where(
32
- oauth_applications_homepage_url_column => saml_assertion.audiences,
33
- oauth_applications_redirect_uri_column => redirect_uri
34
- ).first
35
-
36
- # The Assertion's <Issuer> element MUST contain a unique identifier
37
- # for the entity that issued the Assertion.
38
- authorization_required unless saml_assertion.issuers.all? do |issuer|
39
- issuer.start_with?(@oauth_application[oauth_applications_homepage_url_column])
40
- end
41
-
42
- authorization_required unless @oauth_application
43
- end
44
-
45
- private
46
-
47
- def secret_matches?(oauth_application, secret)
48
- return super unless param_or_nil("assertion")
49
-
50
- true
51
- end
52
-
53
- def saml_assertion
54
- return @saml_assertion if defined?(@saml_assertion)
55
-
56
- @saml_assertion = begin
57
- settings = OneLogin::RubySaml::Settings.new
58
- settings.idp_cert_fingerprint = oauth_saml_cert_fingerprint
59
- settings.idp_cert_fingerprint_algorithm = oauth_saml_cert_fingerprint_algorithm
60
- settings.name_identifier_format = oauth_saml_name_identifier_format
61
- settings.security[:authn_requests_signed] = oauth_saml_security_authn_requests_signed
62
- settings.security[:metadata_signed] = oauth_saml_security_metadata_signed
63
- settings.security[:digest_method] = oauth_saml_security_digest_method
64
- settings.security[:signature_method] = oauth_saml_security_signature_method
65
-
66
- response = OneLogin::RubySaml::Response.new(param("assertion"), settings: settings, skip_recipient_check: true)
67
-
68
- return unless response.is_valid?
69
-
70
- response
71
- end
72
- end
73
-
74
- def validate_oauth_token_params
75
- return super unless param("grant_type") == SAML_GRANT_TYPE
76
-
77
- redirect_response_error("invalid_client") unless param_or_nil("assertion")
78
-
79
- redirect_response_error("invalid_scope") unless check_valid_scopes?
80
- end
81
-
82
- def create_oauth_token
83
- if param("grant_type") == SAML_GRANT_TYPE
84
- create_oauth_token_from_saml_assertion
85
- else
86
- super
87
- end
88
- end
89
-
90
- def create_oauth_token_from_saml_assertion
91
- account = db[accounts_table].where(login_column => saml_assertion.nameid).first
92
-
93
- redirect_response_error("invalid_client") unless oauth_application && account
94
-
95
- create_params = {
96
- oauth_tokens_account_id_column => account[account_id_column],
97
- oauth_tokens_oauth_application_id_column => oauth_application[oauth_applications_id_column],
98
- oauth_tokens_scopes_column => (param_or_nil("scope") || oauth_application[oauth_applications_scopes_column])
99
- }
100
-
101
- generate_oauth_token(create_params, false)
102
- end
103
- end
104
- end