auth_origin_control 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDA1OWM3Y2E1MWE0NGUzOWI0NDdkN2E3NDIyNWE1MTA3NGRmNmQ5Zg==
4
+ NjVhNjJlNzQyMzliZTBhNDE3ZDVmZWVlZDA1OTU1ZGE5YWMwMDc0Mg==
5
5
  data.tar.gz: !binary |-
6
- YjE0ZjNkYWQ1ZGQwMWU0ZWM5MDY3MDg2ZGQyNzIzMzJjYTYyMDRiYw==
6
+ OTUxNDY5NDVlODBmZDQ4NTFmNmUzY2I1OWJhNzYwMjUzODhhY2FmMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDNhNThmYjU1YWYxYjQ1ZTNmNDQzZTFhOTA3MDlmYTgwMDA4MDRlZTNkMTdj
10
- OWRkYTlmMzdhYTFiOTYxNGExOGUxNWFkNmU5YTIyNDhiOGE3ZjkxYTA1YTIz
11
- YTVmNmM5NzdhY2VjNTRhZDA5NGUzODZhNTQ4YTU0OTM4MDAwOTc=
9
+ NWQzZjQ1NTZjYWZmZGQzNDQ4MmNlODY1MjY0MWY5YmIxNTQ1NjQwODBjMWZl
10
+ NzViNmJmMGY1NjE4NmY0M2IzYmM1ZWJlMmNhZWY2MmZkNTM5NTdiZTRhNjEw
11
+ ZDY2NTU3ODRlYjI0MjVlZDk1YmY0OGVlMGU2MGQ5YjgxMDNhNTU=
12
12
  data.tar.gz: !binary |-
13
- NDNlZjA1NjVjNGFmYzdmMTI2NDNkMDgzODAxYTU5NGI4MmQ2MmFjZWQ0OGIw
14
- MzhjY2JiY2YyNzQ5Zjg2MWM0N2U2MzAwNjkxYTA1MzNmOTc0NzYxM2E4ZWIx
15
- ZDE5YWNiNGQ4Y2Q4OTBlNzFjMzA2OGI4ODRhZmZlNjUwNDhkNWE=
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
- config: @config
19
- }).authentified_app
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
@@ -36,6 +36,7 @@ module AuthOriginControl
36
36
  end
37
37
 
38
38
  def result_raw
39
+ puts 'sent'
39
40
  signed_authority_request.execute do |response, request, result|
40
41
  return response
41
42
  end
@@ -1,3 +1,3 @@
1
1
  module AuthOriginControl
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -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.6
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-08-30 00:00:00.000000000 Z
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