octopus_auth 0.1.0.rc3 → 0.1.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 826544084e17baa43f7f6cf1b7d372a82f702b900758079e6b1f27bdf9c4a557
4
- data.tar.gz: df7bc4b566621e579c0c1788d653fa0f2baee984d9db3cef98c01a65eb2d97ce
3
+ metadata.gz: dea163ab3acbfb9fb64c8dea4596562e14d3ac465ce3c3ba8c9c13c42f186473
4
+ data.tar.gz: 30bf9a7272d92c5b81cffa2b28776f81e16a33e9a1ed59c57dad50df7d0ff175
5
5
  SHA512:
6
- metadata.gz: ef1cb35e874555d690eabcc44610c181153bdc50e9338fafbb05d5331873774c2436c912366af0b7d15b71df24d38d9e6f7d1b4730ce21df2850245684227cd0
7
- data.tar.gz: f124b4c7e3de3566ea9bd5a67f8bc26022bb4bb20eea9b57a10f878ae983d1524f359fc3344d73b8bd6f813fb542519e3790b5a2512d32218f7607105ad771bc
6
+ metadata.gz: 5b69d6cda506b681ba86863a2fec17ca366b6d7abe61c21b321e447b7b1e8f006b3bb8577fffe9132246d77a5fc1f947c344367c26a403909a12c3e2ab08b047
7
+ data.tar.gz: 2840c1bed3397ba04f85e89ce712109a161c6d0fb86fc6c0ec97eaf7ccd7fccd8c58c6717862002ef165263790442d6c251ef66c7e5d0c3609c47ea1adfec4c4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octopus_auth (0.1.0.rc3)
4
+ octopus_auth (0.1.0.rc4)
5
5
  activerecord (>= 3.0.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -51,6 +51,7 @@ Currently, model class `AccessToken` must be an ActiveRecord sub class. with att
51
51
  :issued_at,
52
52
  :active,
53
53
  :expires_at,
54
+ :expired_at,
54
55
  :scope,
55
56
  :owner_id,
56
57
  :owner_type,
@@ -9,8 +9,7 @@ module OctopusAuth
9
9
  return false if @token.empty?
10
10
 
11
11
  access_token = OctopusAuth.configuration.model_class.find_by(token: @token)
12
- return false unless access_token && access_token.active?
13
- return false if access_token.scope.to_sym != @scope
12
+ return false unless access_token && valid?(access_token)
14
13
 
15
14
  if access_token.expires_at.utc < Time.now.utc
16
15
  unless OctopusAuth.configuration.model_readonly
@@ -25,6 +24,12 @@ module OctopusAuth
25
24
 
26
25
  private
27
26
 
27
+ def valid?(access_token)
28
+ access_token.active? &&
29
+ !access_token.expired_at &&
30
+ access_token.scope.to_sym == @scope
31
+ end
32
+
28
33
  ResultObject = Struct.new(:token, :owner_id, :owner_type, :scope)
29
34
  def build_success_result(access_token)
30
35
  ResultObject.new(access_token.token,
@@ -7,6 +7,7 @@ module OctopusAuth
7
7
  :issued_at, # Keep here just for compatible reason, use `issued_at` instead
8
8
  :active,
9
9
  :expires_at,
10
+ :expired_at,
10
11
  :scope,
11
12
  :owner_id,
12
13
  :owner_type,
@@ -1,3 +1,3 @@
1
1
  module OctopusAuth
2
- VERSION = "0.1.0.rc3"
2
+ VERSION = "0.1.0.rc4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopus_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc3
4
+ version: 0.1.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TINYpulse Devops