auth0_current_user 0.2.1 → 0.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: 04b57d13c9018a8184b2474ecf1f3031a5d0b87a961f07ac6dcd4db03689f2ee
4
- data.tar.gz: '0393295868660f4f19c785e2c9cf21343f12df603394b98919a2b9e1557c51eb'
3
+ metadata.gz: e328e498710b8747cd3b3e6fa46321c0421023a601b67baa4f73b5a6661a4547
4
+ data.tar.gz: 5a7d9ac31f4a0f1497f3cc03a9bf32d14fa055f8ed1db7789d6894c08db0250e
5
5
  SHA512:
6
- metadata.gz: e23a9950bc5514039fb35b0cc8671e192e22629864521449e235260c12cbc350cef1de9093d22cea16b6794c9f2d1431dbef66557f028fd2ff42d17190b8c43d
7
- data.tar.gz: ff233b630c6ec27000d1f3a46f15047648158c73602e7e451687095527c4051e24d3f8c744d0b428b4ea0dc7d4cd917fb6893cbe55f646b1e86544429ae44311
6
+ metadata.gz: 15852264e476b984ebf02119c91728cefff2e6c0e67c8c13b774acb70910a65a0875986fd6a54795434c695c56c62320d1b603a466fe0e25aab376836a5c78e2
7
+ data.tar.gz: 81dd34df56d368bdf5ff99fdaefe0d95594d63d623932c887314e50174451e1aa628ecc0bb3caaab160f4088222f80373222733327767a6b9d2f2cffa7bd9066
@@ -58,7 +58,7 @@ module ApiSecured
58
58
  end
59
59
 
60
60
  def configuration
61
- @configuration ||= Configuration.new
61
+ @configuration ||= Auth0CurrentUser.configuration
62
62
  end
63
63
 
64
64
  end
@@ -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,3 @@
1
1
  module Auth0CurrentUser
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3"
3
3
  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 '/' unless session[:userinfo].present? && Time.zone.now < Time.zone.at(userinfo['exp'])
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.2.1
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: 2021-12-29 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport