gamora 0.9.0 → 0.11.0
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/README.md +17 -0
- data/lib/gamora/authentication/base.rb +2 -9
- data/lib/gamora/configuration.rb +0 -1
- data/lib/gamora/user.rb +1 -0
- data/lib/gamora/version.rb +1 -1
- data/lib/generators/gamora/templates/gamora.rb +0 -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: e35b31caf66937012f903a789beed12bac91e7e7a809a3e08fd3f1afc69cad19
|
4
|
+
data.tar.gz: f4ec146d7b34b0e6f011f923998d4abfefac5c6ebb421eb4b6eb650d40f63898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c71974d1b67d1d7ba20cebc8d5df51b1a948400a18aa74f3e39d37f4cd74f80c8675ab1388d067f8917d69ca31efca6893396a4efcddf3bcc1a95a0241267731
|
7
|
+
data.tar.gz: b1c6c5a879a035bc768e4c98a9f67d42d5f8e80aa9e0f42aff1fd6dfeacb02bd2611967b171471f328595cf38a73c676bfd08bc51087614dd83380eeb2a95f6b
|
data/README.md
CHANGED
@@ -115,6 +115,23 @@ Optionally, if you want to do something different when authentication
|
|
115
115
|
fails, you just need to override the `user_authentication_failed!`
|
116
116
|
method in you controller and customize it as you wish.
|
117
117
|
|
118
|
+
## Caching
|
119
|
+
|
120
|
+
In order to avoid performing requests to the IDP on each request in the
|
121
|
+
application, it is possible to set a caching time for introspection and
|
122
|
+
userinfo endpoints. Make sure to not have a too long expiration time for
|
123
|
+
`introspect_cache_expires_in` but not too short to impact the application
|
124
|
+
performance, it is a balance.
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
Gamora.setup do |config|
|
128
|
+
...
|
129
|
+
|
130
|
+
config.userinfo_cache_expires_in = 10.minute
|
131
|
+
config.introspect_cache_expires_in = 5.seconds
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
118
135
|
## Development
|
119
136
|
|
120
137
|
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
@@ -7,6 +7,7 @@ module Gamora
|
|
7
7
|
sub: :id,
|
8
8
|
roles: :roles,
|
9
9
|
email: :email,
|
10
|
+
username: :username,
|
10
11
|
given_name: :first_name,
|
11
12
|
family_name: :last_name,
|
12
13
|
phone_number: :phone_number,
|
@@ -41,15 +42,7 @@ module Gamora
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def valid_token_data?(token_data)
|
44
|
-
token_data[:active]
|
45
|
-
end
|
46
|
-
|
47
|
-
def whitelisted_client?(client_id)
|
48
|
-
whitelisted_clients.include?(client_id)
|
49
|
-
end
|
50
|
-
|
51
|
-
def whitelisted_clients
|
52
|
-
Configuration.whitelisted_clients | [Configuration.client_id]
|
45
|
+
token_data[:active]
|
53
46
|
end
|
54
47
|
|
55
48
|
def assign_current_user_from_claims(claims)
|
data/lib/gamora/configuration.rb
CHANGED
@@ -19,7 +19,6 @@ module Gamora
|
|
19
19
|
mattr_accessor :ui_locales, default: -> { I18n.locale }
|
20
20
|
mattr_accessor :userinfo_cache_expires_in, default: 1.minute
|
21
21
|
mattr_accessor :introspect_cache_expires_in, default: 0.seconds
|
22
|
-
mattr_accessor :whitelisted_clients, default: []
|
23
22
|
|
24
23
|
def setup
|
25
24
|
yield(self) if block_given?
|
data/lib/gamora/user.rb
CHANGED
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.11.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:
|
11
|
+
date: 2024-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|