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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/octopus_auth/authenticator.rb +7 -2
- data/lib/octopus_auth/decorators.rb +1 -0
- data/lib/octopus_auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dea163ab3acbfb9fb64c8dea4596562e14d3ac465ce3c3ba8c9c13c42f186473
|
4
|
+
data.tar.gz: 30bf9a7272d92c5b81cffa2b28776f81e16a33e9a1ed59c57dad50df7d0ff175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b69d6cda506b681ba86863a2fec17ca366b6d7abe61c21b321e447b7b1e8f006b3bb8577fffe9132246d77a5fc1f947c344367c26a403909a12c3e2ab08b047
|
7
|
+
data.tar.gz: 2840c1bed3397ba04f85e89ce712109a161c6d0fb86fc6c0ec97eaf7ccd7fccd8c58c6717862002ef165263790442d6c251ef66c7e5d0c3609c47ea1adfec4c4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -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
|
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,
|
data/lib/octopus_auth/version.rb
CHANGED