gamora 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gamora/authentication/base.rb +15 -1
- data/lib/gamora/configuration.rb +1 -0
- data/lib/gamora/version.rb +1 -1
- data/lib/generators/gamora/templates/gamora.rb +1 -0
- 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: 563e700187ac79aef45f7d11aad774aee205f7917870f5431d3f1d6d63d7850b
|
4
|
+
data.tar.gz: 9817af7d6c4eb85abb6bdaa76d53efc0f1016f6516df95c674366b89ab920b49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34de3119b475580ec5b65cab413d8f6ca7aed17fe433542ea81c6ef5ba314a67d9a29c384dd2aaafc9a9ff267510efbf6649a33f43fb7d41a15a0d3b7c308661
|
7
|
+
data.tar.gz: 2848933923aee39b310b107e77c6ec219b6642f0bda21c0e61677fbf056f3f80629f0d9bed0dbb81ea2637483d333de77292a871d86a358f19d98e1bade10b69
|
@@ -47,12 +47,26 @@ module Gamora
|
|
47
47
|
|
48
48
|
def resource_owner_claims(access_token)
|
49
49
|
return {} if access_token.blank?
|
50
|
-
|
50
|
+
resource_owner_claims!(access_token)
|
51
|
+
end
|
52
|
+
|
53
|
+
def resource_owner_claims!(access_token)
|
54
|
+
Rails.cache.fetch(cache_key(access_token), cache_options) do
|
55
|
+
oauth_client.userinfo(access_token)
|
56
|
+
end
|
51
57
|
end
|
52
58
|
|
53
59
|
def oauth_client
|
54
60
|
Client.from_config
|
55
61
|
end
|
62
|
+
|
63
|
+
def cache_options
|
64
|
+
{ expires_in: Configuration.userinfo_cache_expires_in }
|
65
|
+
end
|
66
|
+
|
67
|
+
def cache_key(access_token)
|
68
|
+
"userinfo:#{Digest::SHA256.hexdigest(access_token)}"
|
69
|
+
end
|
56
70
|
end
|
57
71
|
end
|
58
72
|
end
|
data/lib/gamora/configuration.rb
CHANGED
@@ -16,6 +16,7 @@ module Gamora
|
|
16
16
|
mattr_accessor :default_branding, default: "amco"
|
17
17
|
mattr_accessor :default_theme, default: "default"
|
18
18
|
mattr_accessor :ui_locales, default: -> { I18n.locale }
|
19
|
+
mattr_accessor :userinfo_cache_expires_in, default: 0.seconds
|
19
20
|
|
20
21
|
def setup
|
21
22
|
yield(self) if block_given?
|
data/lib/gamora/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Gutiérrez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|