phcdevworks_accounts_auth0 1.1.3b → 1.1.4b
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/phcdevworks_accounts_auth0/auth/handler_controller.rb +7 -8
- data/app/helpers/phcdevworks_accounts_auth0/application_helper.rb +21 -21
- data/app/views/phcdevworks_accounts_auth0/auth/handler/failure.html.erb +4 -1
- data/config/initializers/auth0.rb +5 -5
- data/lib/phcdevworks_accounts_auth0/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fc14fb563076fee0a16e7c6a3d8244da06627d0920686eb4d02b3a94af5eb09
|
4
|
+
data.tar.gz: fd6db32697b2884d145c466edecb995990787bff9fc2fbbf9773723713657ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99d27d09c5427b769a465f4c855a66b24bf629c6b56dbac4d489a9a9644e326c17427b866cde705e7fd84799576a62349bcc301a912fd37d8818a0fb8493c25c
|
7
|
+
data.tar.gz: 4a0f6828d97e6c9a918afa4194fa8a3b78df3be28de97f398219dd5e96a68a990112eda534f4be4234c3dcf7bcfe0c1e228d5d4e433aca0a88f2f3c07a5a4f4d
|
@@ -1,14 +1,13 @@
|
|
1
|
-
module PhcdevworksAccountsAuth0
|
1
|
+
module PhcdevworksAccountsAuth0
|
2
2
|
class Auth::HandlerController < ApplicationController
|
3
3
|
|
4
4
|
def callback
|
5
|
-
|
6
|
-
session[:userinfo] = auth_info["extra"]["raw_info"]
|
5
|
+
session[:userinfo] = request.env['omniauth.auth']['extra']['raw_info']
|
7
6
|
redirect_to main_app.root_path
|
8
7
|
end
|
9
8
|
|
10
9
|
def failure
|
11
|
-
@error_msg = request.params[
|
10
|
+
@error_msg = request.params['message']
|
12
11
|
end
|
13
12
|
|
14
13
|
def logout
|
@@ -18,14 +17,14 @@ module PhcdevworksAccountsAuth0
|
|
18
17
|
|
19
18
|
private
|
20
19
|
|
21
|
-
AUTH0_CONFIG = Rails.application.
|
20
|
+
AUTH0_CONFIG = Rails.application.config.auth0
|
22
21
|
|
23
22
|
def logout_url
|
24
23
|
request_params = {
|
25
|
-
returnTo:
|
26
|
-
client_id:
|
24
|
+
returnTo: root_url,
|
25
|
+
client_id: Rails.application.config.auth0['auth0_client_id']
|
27
26
|
}
|
28
|
-
URI::HTTPS.build(host: AUTH0_CONFIG[
|
27
|
+
URI::HTTPS.build(host: AUTH0_CONFIG['auth0_domain'], path: '/v2/logout', query: request_params.to_query).to_s
|
29
28
|
end
|
30
29
|
|
31
30
|
def to_query(hash)
|
@@ -1,29 +1,29 @@
|
|
1
1
|
module PhcdevworksAccountsAuth0
|
2
|
-
|
2
|
+
module ApplicationHelper
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
def user_signed_in?
|
5
|
+
session['userinfo'].present?
|
6
|
+
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
def authenticate_user!
|
9
|
+
if user_signed_in?
|
10
|
+
@current_user = session['userinfo']
|
11
|
+
else
|
12
|
+
redirect_to root_path
|
13
|
+
end
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def current_user
|
17
|
+
@current_user
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def reset_session
|
21
|
+
session['userinfo'] = nil if session['userinfo'].present?
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def current_user
|
25
|
+
@current_user = session['userinfo']
|
26
|
+
end
|
27
27
|
|
28
|
-
|
28
|
+
end
|
29
29
|
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
Rails.application.config.auth0 = Rails.application.config_for(:auth0)
|
2
2
|
|
3
3
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
4
4
|
provider(
|
5
5
|
:auth0,
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
Rails.application.config.auth0['auth0_client_id'],
|
7
|
+
Rails.application.config.auth0['auth0_client_secret'],
|
8
|
+
Rails.application.config.auth0['auth0_domain'],
|
9
9
|
callback_path: '/auth/callback',
|
10
10
|
authorize_params: {
|
11
|
-
scope: 'openid profile'
|
11
|
+
scope: 'openid profile email'
|
12
12
|
}
|
13
13
|
)
|
14
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcdevworks_accounts_auth0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4b
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-02
|
12
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|