model_driven_api 3.4.1 → 3.4.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 +4 -4
- data/app/controllers/api/v2/auth/oauth_controller.rb +1 -8
- data/config/routes.rb +2 -3
- data/lib/model_driven_api/version.rb +1 -1
- data/lib/model_driven_api.rb +0 -4
- metadata +1 -44
- data/config/initializers/omniauth.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dab5906eeb7f41358f97e9ca38233e52ad156c2220a18dbea567503a987f8f9
|
4
|
+
data.tar.gz: a37524b760679665f515969501d5672474fa17fc76dcb1f09ee8e852ae11e0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f8db3a7710aa33b4113541c74ca4d8b8907ccdedc97e38c34057333e8cf4f8dcf8d48a7fa6d650f73f20f5615025a4a03c03bae89bc4097fb313846be422ad6
|
7
|
+
data.tar.gz: 71cc223375df7a9e002a4c9bc68203ae971b43d9d95bef3fa6b9ecf4d594f4cbfa81a158e47f986395812e68ce24448ba93dd1b2b6189fe1f1309ad139ac53fa
|
@@ -1,15 +1,8 @@
|
|
1
1
|
module Api::V2::Auth
|
2
2
|
class OauthController < ActionController::API
|
3
3
|
def callback
|
4
|
-
|
4
|
+
user = ThecoreAuthCommons.check_user params['email'], params['given_name'], params['family_name'], params['provider']
|
5
5
|
|
6
|
-
user = User.find_or_create_by(email: email) do |u|
|
7
|
-
u.name = params['given_name']
|
8
|
-
u.surname = params['family_name']
|
9
|
-
u.password = u.password_confirmation = ThecoreAuthCommons.generate_secure_password
|
10
|
-
u.auth_source = params['provider'] # 'google' or 'microsoft'
|
11
|
-
u.admin = true
|
12
|
-
end
|
13
6
|
unless user
|
14
7
|
render json: { error: "User not registered" }, status: :unauthorized
|
15
8
|
return
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# require 'ransack'
|
2
2
|
|
3
3
|
Rails.application.routes.draw do
|
4
|
-
oauth_test = (ENV['ENTRA_CLIENT_ID'].present? && ENV['ENTRA_CLIENT_SECRET'].present? && ENV['ENTRA_TENANT_ID'].present?) || (ENV['GOOGLE_CLIENT_ID'].present? && ENV['GOOGLE_CLIENT_SECRET'].present?)
|
5
4
|
scope ENV.fetch("RAILS_RELATIVE_URL_ROOT", "/") do
|
6
|
-
if
|
5
|
+
if ThecoreAuthCommons.oauth_vars?
|
7
6
|
# OmniAuth callbacks need these top-level paths:
|
8
7
|
match '/auth/:provider/callback', to: redirect('/api/v2/auth/%{provider}/callback'), via: [:get, :post]
|
9
8
|
match '/auth/failure', to: redirect('/api/v2/auth/failure'), via: [:get, :post]
|
@@ -11,7 +10,7 @@ Rails.application.routes.draw do
|
|
11
10
|
namespace :api, constraints: { format: :json } do
|
12
11
|
namespace :v2 do
|
13
12
|
# Authentication via Oauth2 only if the environment variable is set
|
14
|
-
if
|
13
|
+
if ThecoreAuthCommons.oauth_vars?
|
15
14
|
namespace :auth do
|
16
15
|
# Omniauth routes for OAuth2 authentication
|
17
16
|
match ':provider/callback', to: 'oauth#callback', via: [:get, :post]
|
data/lib/model_driven_api.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_driven_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
@@ -93,48 +93,6 @@ dependencies:
|
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '1.2'
|
96
|
-
- !ruby/object:Gem::Dependency
|
97
|
-
name: omniauth
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '2.1'
|
103
|
-
type: :runtime
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '2.1'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: omniauth-google-oauth2
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '1.2'
|
117
|
-
type: :runtime
|
118
|
-
prerelease: false
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '1.2'
|
124
|
-
- !ruby/object:Gem::Dependency
|
125
|
-
name: omniauth-entra-id
|
126
|
-
requirement: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '3.0'
|
131
|
-
type: :runtime
|
132
|
-
prerelease: false
|
133
|
-
version_requirements: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '3.0'
|
138
96
|
- !ruby/object:Gem::Dependency
|
139
97
|
name: sqlite3
|
140
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +132,6 @@ files:
|
|
174
132
|
- config/initializers/after_initialize_for_model_driven_api.rb
|
175
133
|
- config/initializers/cors_api_thecore.rb
|
176
134
|
- config/initializers/knock.rb
|
177
|
-
- config/initializers/omniauth.rb
|
178
135
|
- config/initializers/time_with_zone.rb
|
179
136
|
- config/initializers/wrap_parameters.rb
|
180
137
|
- config/routes.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
2
|
-
provider(
|
3
|
-
:entra_id,
|
4
|
-
{
|
5
|
-
client_id: ENV['ENTRA_CLIENT_ID'],
|
6
|
-
client_secret: ENV['ENTRA_CLIENT_SECRET'],
|
7
|
-
tenant_id: ENV['ENTRA_TENANT_ID'], # Needed for Microsoft
|
8
|
-
scope: 'User.Read',
|
9
|
-
response_type: 'code'
|
10
|
-
}
|
11
|
-
)
|
12
|
-
provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'], {
|
13
|
-
scope: 'email,profile',
|
14
|
-
prompt: 'select_account',
|
15
|
-
access_type: 'online'
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
OmniAuth.config.allowed_request_methods = [:get, :post]
|
20
|
-
OmniAuth.config.silence_get_warning = true
|