auth_origin_control 0.0.6 → 0.0.7
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,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjVhNjJlNzQyMzliZTBhNDE3ZDVmZWVlZDA1OTU1ZGE5YWMwMDc0Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTUxNDY5NDVlODBmZDQ4NTFmNmUzY2I1OWJhNzYwMjUzODhhY2FmMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWQzZjQ1NTZjYWZmZGQzNDQ4MmNlODY1MjY0MWY5YmIxNTQ1NjQwODBjMWZl
|
10
|
+
NzViNmJmMGY1NjE4NmY0M2IzYmM1ZWJlMmNhZWY2MmZkNTM5NTdiZTRhNjEw
|
11
|
+
ZDY2NTU3ODRlYjI0MjVlZDk1YmY0OGVlMGU2MGQ5YjgxMDNhNTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2ZiN2ViYTY4MmY3MmQzY2I1MTNkNDg4YWYzMDE4ZmNkMThhZDI1ZDI0ZGQ5
|
14
|
+
ZWMwMmQzYzUwZmE0ZjlkMmY1NDJjOTZkMzFmYjM3M2I4MDQ5NmIzMzcxNWMy
|
15
|
+
NWEwZGRkNGExNjZiNTBjNzg2YjA4YzRkZTFjNWRhMDM5YTU2NWM=
|
@@ -2,6 +2,7 @@ require "auth_origin_control/encoded_secret/encoded_secret"
|
|
2
2
|
require "auth_origin_control/signed_request/request"
|
3
3
|
require "auth_origin_control/helpers/helpers"
|
4
4
|
require 'auth_origin_control/api_auth/app'
|
5
|
+
require 'auth_origin_control/booster'
|
5
6
|
|
6
7
|
module AuthOriginControl
|
7
8
|
class Base
|
@@ -14,9 +15,12 @@ module AuthOriginControl
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def app
|
17
|
-
AuthOriginControl::ApiAuth::App.new(@request, { local: (@local),
|
18
|
-
|
19
|
-
|
18
|
+
_app = AuthOriginControl::ApiAuth::App.new(@request, { local: (@local),
|
19
|
+
config: @config
|
20
|
+
})
|
21
|
+
_id = _app.access_id
|
22
|
+
|
23
|
+
AuthOriginControl::Booster.get(_id) || AuthOriginControl::Booster.set _id, _app.authentified_app
|
20
24
|
end
|
21
25
|
|
22
26
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module AuthOriginControl
|
2
|
+
class Booster
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def redis
|
6
|
+
AuthOriginControl.redis_connection
|
7
|
+
end
|
8
|
+
|
9
|
+
def namespaced_key key
|
10
|
+
"#{key} - AuthOriginControl_Booster"
|
11
|
+
end
|
12
|
+
|
13
|
+
def get key
|
14
|
+
val = redis.get(key)
|
15
|
+
val ? JSON.parse(val) : nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def set key, val
|
19
|
+
redis.set key, val.try(:to_json).try(:to_s), ex: AuthOriginControl.redis_cache_expiration
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/auth_origin_control.rb
CHANGED
@@ -49,6 +49,15 @@ module AuthOriginControl
|
|
49
49
|
|
50
50
|
# allow working offline without looking for online auth api
|
51
51
|
mattr_accessor :no_connection, :registered_apps
|
52
|
+
|
53
|
+
mattr_accessor :redis_connection, :redis_config, :redis_cache_expiration
|
54
|
+
def self.redis_connection
|
55
|
+
@@redis_connection ||= @@redis_config ? Redis.new(@@redis_config) : nil
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.redis_cache_expiration
|
59
|
+
@@redis_cache_expiration ||= 360
|
60
|
+
end
|
52
61
|
|
53
62
|
def self.setup
|
54
63
|
yield self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth_origin_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NicoArbogast
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/auth_origin_control/api_auth/identification/local.rb
|
99
99
|
- lib/auth_origin_control/api_auth/identification/remote.rb
|
100
100
|
- lib/auth_origin_control/base.rb
|
101
|
+
- lib/auth_origin_control/booster.rb
|
101
102
|
- lib/auth_origin_control/encoded_secret/encoded_secret.rb
|
102
103
|
- lib/auth_origin_control/engine.rb
|
103
104
|
- lib/auth_origin_control/helpers/helpers.rb
|