auth0_current_user 0.2.1 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e328e498710b8747cd3b3e6fa46321c0421023a601b67baa4f73b5a6661a4547
|
4
|
+
data.tar.gz: 5a7d9ac31f4a0f1497f3cc03a9bf32d14fa055f8ed1db7789d6894c08db0250e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15852264e476b984ebf02119c91728cefff2e6c0e67c8c13b774acb70910a65a0875986fd6a54795434c695c56c62320d1b603a466fe0e25aab376836a5c78e2
|
7
|
+
data.tar.gz: 81dd34df56d368bdf5ff99fdaefe0d95594d63d623932c887314e50174451e1aa628ecc0bb3caaab160f4088222f80373222733327767a6b9d2f2cffa7bd9066
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module Auth0CurrentUser
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :auth0_domain, :auth0_audience, :authenticated_klass
|
3
|
+
attr_accessor :auth0_domain, :auth0_audience, :authenticated_klass, :client_id
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@auth0_domain = nil
|
7
7
|
@auth0_audience = nil
|
8
8
|
@authenticated_klass = :user
|
9
|
+
@client_id = nil
|
9
10
|
end
|
10
11
|
|
11
12
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'auth0_current_user/configuration'
|
2
|
+
|
1
3
|
module Auth0CurrentUser
|
2
4
|
module WebSecured
|
3
5
|
extend ActiveSupport::Concern
|
@@ -35,13 +37,21 @@ module Auth0CurrentUser
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def logged_in_using_omniauth?
|
38
|
-
redirect_to
|
40
|
+
redirect_to authorization_endpoint unless session[:userinfo].present? && Time.zone.now < Time.zone.at(userinfo['exp'])
|
41
|
+
end
|
42
|
+
|
43
|
+
def authorization_endpoint
|
44
|
+
@_authorization_endpoint ||= "https://#{configuration.auth0_domain}/authorize?response_type=code&client_id=#{configuration.client_id}"
|
39
45
|
end
|
40
46
|
|
41
47
|
def userinfo
|
42
48
|
session['userinfo'] || {}
|
43
49
|
end
|
44
50
|
|
51
|
+
def configuration
|
52
|
+
@configuration ||= Auth0CurrentUser.configuration
|
53
|
+
end
|
54
|
+
|
45
55
|
end
|
46
56
|
end
|
47
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth0_current_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Heft
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|