octopus_auth 0.1.0.rc1 → 0.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -1
- data/README.md +4 -0
- data/lib/octopus_auth/authenticator.rb +4 -4
- data/lib/octopus_auth/version.rb +1 -1
- data/octopus_auth.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c0908e0912d618fb610829e9a8564f72d6cf88548c6546269982f07c23fcb9
|
4
|
+
data.tar.gz: 2f50559bfcdc74b903853103fa4cf73ea37edad5ac6241d43282ad811d21246f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d0f493cbaf4685d3529d018afe37e0e60ec4a50ce900460ae8424a474b5879869519e8a793773d0e750b0c7c8b23bc6031b56301fc6898f6e85074692c8c7a3
|
7
|
+
data.tar.gz: 56d67d6f4e91db23b5227105ed1e9321e285df0b9c1c3b56985a29350ca41ade1893445d972a6689776f8aa04e7c2ffc971861a8e56fdea6db1fbe3046a3cde3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
octopus_auth (0.1.0.
|
4
|
+
octopus_auth (0.1.0.rc2)
|
5
5
|
activerecord (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -19,11 +19,20 @@ GEM
|
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
21
|
arel (9.0.0)
|
22
|
+
byebug (11.0.1)
|
23
|
+
coderay (1.1.2)
|
22
24
|
concurrent-ruby (1.1.5)
|
23
25
|
diff-lcs (1.3)
|
24
26
|
i18n (1.6.0)
|
25
27
|
concurrent-ruby (~> 1.0)
|
28
|
+
method_source (0.9.2)
|
26
29
|
minitest (5.11.3)
|
30
|
+
pry (0.12.2)
|
31
|
+
coderay (~> 1.1.0)
|
32
|
+
method_source (~> 0.9.0)
|
33
|
+
pry-byebug (3.7.0)
|
34
|
+
byebug (~> 11.0)
|
35
|
+
pry (~> 0.10)
|
27
36
|
rake (10.5.0)
|
28
37
|
rspec (3.8.0)
|
29
38
|
rspec-core (~> 3.8.0)
|
@@ -48,6 +57,7 @@ PLATFORMS
|
|
48
57
|
DEPENDENCIES
|
49
58
|
bundler (~> 1.16)
|
50
59
|
octopus_auth!
|
60
|
+
pry-byebug
|
51
61
|
rake (~> 10.0)
|
52
62
|
rspec (~> 3.0)
|
53
63
|
|
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/TINYhr/octopus_auth.svg?branch=master)](https://travis-ci.org/TINYhr/octopus_auth)
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/octopus_auth.svg)](https://badge.fury.io/rb/octopus_auth)
|
4
|
+
|
1
5
|
# OctopusAuth
|
2
6
|
|
3
7
|
OctopusAuth provides mechanism to:
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module OctopusAuth
|
2
2
|
class Authenticator
|
3
3
|
def initialize(token, scope = nil)
|
4
|
-
@token = token
|
4
|
+
@token = token.to_s
|
5
5
|
@scope = scope || OctopusAuth.configuration.default_scope
|
6
6
|
end
|
7
7
|
|
8
8
|
def authenticate
|
9
|
-
return false if @token.
|
9
|
+
return false if @token.empty?
|
10
10
|
|
11
11
|
access_token = OctopusAuth.configuration.model_class.find_by(token: @token)
|
12
12
|
return false unless access_token && access_token.active?
|
13
13
|
return false if access_token.scope.to_sym != @scope
|
14
14
|
|
15
|
-
if access_token.expires_at
|
16
|
-
access_token.update(active: false, expired_at: Time.
|
15
|
+
if access_token.expires_at.utc < Time.now.utc
|
16
|
+
access_token.update(active: false, expired_at: Time.now.utc)
|
17
17
|
return false
|
18
18
|
end
|
19
19
|
|
data/lib/octopus_auth/version.rb
CHANGED
data/octopus_auth.gemspec
CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 1.16"
|
37
37
|
spec.add_development_dependency "rake", "~> 10.0"
|
38
38
|
spec.add_development_dependency "rspec", "~> 3.0"
|
39
|
+
spec.add_development_dependency "pry-byebug"
|
39
40
|
|
40
41
|
spec.add_dependency "activerecord", ">= 3.0.0"
|
41
42
|
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.
|
4
|
+
version: 0.1.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TINYpulse Devops
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activerecord
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|