capcoauth 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/capcoauth.gemspec +1 -0
- data/lib/capcoauth/config.rb +3 -0
- data/lib/capcoauth/oauth/ttl_cache.rb +9 -10
- data/lib/capcoauth/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48878ea66857e9efa43a5a837d28db91d9ccc918
|
4
|
+
data.tar.gz: a8568a00c443097287e69768ec3bc040a785b1a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f41ff5dddad8bc139d69c0af461b771bd77f393032519aa74c4f30dd8370c343ee3026ebe83b2507f05f2e75ad716ae4d8c858aeb7cd5bcfd860c7a02c42bbb
|
7
|
+
data.tar.gz: d49ebd6f95a3711fe44d097872d9f999f3f7188ef0ead9641b48abda0466e1f0e4be779eed8526ac56c6e5bb1e8d03b80b252db37751a4e17c38c235380c768e
|
data/capcoauth.gemspec
CHANGED
data/lib/capcoauth/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/cache'
|
2
|
+
|
1
3
|
module Capcoauth
|
2
4
|
class MissingConfiguration < StandardError
|
3
5
|
def initialize
|
@@ -75,6 +77,7 @@ module Capcoauth
|
|
75
77
|
option :token_verify_ttl, default: 10
|
76
78
|
option :capcoauth_url, default: 'https://capcoauth.capco.com'
|
77
79
|
option :user_id_field, default: :capcoauth
|
80
|
+
option :cache_store, default: ::ActiveSupport::Cache::MemoryStore.new
|
78
81
|
option :user_resolver, default: (lambda do |capcoauth_user_id|
|
79
82
|
Capcoauth.configuration.logger.warn('[CapcOAuth] User resolver is not configured. Please specify a block in configuration to resolve the proper user')
|
80
83
|
nil
|
@@ -1,26 +1,25 @@
|
|
1
1
|
module Capcoauth
|
2
2
|
module OAuth
|
3
3
|
class TTLCache
|
4
|
-
@@cache = {}
|
5
4
|
|
6
5
|
def self.user_id_for(access_token)
|
7
|
-
|
8
|
-
return @@cache[access_token][:user_id] if @@cache[access_token].present?
|
9
|
-
nil
|
6
|
+
store.fetch(key_for(access_token))
|
10
7
|
end
|
11
8
|
|
12
9
|
def self.update(access_token, user_id)
|
13
|
-
|
10
|
+
store.write(key_for(access_token), user_id, expires_in: Capcoauth.configuration.token_verify_ttl)
|
14
11
|
end
|
15
12
|
|
16
13
|
def self.remove(access_token)
|
17
|
-
|
14
|
+
store.delete(key_for(access_token))
|
18
15
|
end
|
19
16
|
|
20
|
-
def self.
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
def self.key_for(access_token)
|
18
|
+
"capcoauth_token:#{access_token}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.store
|
22
|
+
Capcoauth.configuration.cache_store
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
data/lib/capcoauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capcoauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '6.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activesupport
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: httparty
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
139
|
version: '0'
|
126
140
|
requirements: []
|
127
141
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.6.7
|
129
143
|
signing_key:
|
130
144
|
specification_version: 4
|
131
145
|
summary: Integration with Capcoauth authentication service
|