octopus_auth 0.1.1 → 0.1.2

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: b7add3210fd9489bfec1179adce0134f27b1fc791524b6106b83feb5eb93ed2a
4
- data.tar.gz: ee7e21b782bc8d6497b936e2672eba8fe68f45d80e8657fe3ffc622001d6a1f8
3
+ metadata.gz: 3ec4eccfedfb4439c5992d1f1b68aef4d7c6c9bc0172ddc544c125964f8f441b
4
+ data.tar.gz: 346c819627d1e06682a4bab819c1686cfad0ae2cd1a56f17c227fc1ae88e9af6
5
5
  SHA512:
6
- metadata.gz: b1ce828aea7ef922e7e49c5eda179d874626c7a62c3bc1b9cf19b5c33b9207125db1a4e89a0594838b9a9d79bd40d98140cff04d41b58eb095dec2e98773dac3
7
- data.tar.gz: e1b2ba2ed8a0017ac15496f04f55b639939abd85e059bf6381e8936725d5882994e29a97f6f9835fac9bd3252c5f8b85088a0b1efa9b73f226540d963b83b62c
6
+ metadata.gz: 72055e00a839c206acd9865d74751091b0aed518801bacba788293866b24612a9ac012efa29e8d1bb1a0c411d16f60dd446d19ba88d359f6da14bea70201178b
7
+ data.tar.gz: 2da237a783db8a4f69aa38d74642277878bf0eed5bace48313c3db3a492de3bdf5fd0ef30bebeb1d1b7b443192a80db8b4496dcfbe79024ecfcdc12675cf7b5f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octopus_auth (0.1.1)
4
+ octopus_auth (0.1.2)
5
5
  activerecord (>= 3.0.0)
6
6
 
7
7
  GEM
data/lib/octopus_auth.rb CHANGED
@@ -10,6 +10,7 @@ require "octopus_auth/revoke"
10
10
  require "octopus_auth/queries"
11
11
 
12
12
  require "octopus_auth/authenticator"
13
+ require "octopus_auth/access_scope_validator"
13
14
 
14
15
  module OctopusAuth
15
16
  class << self
@@ -0,0 +1,24 @@
1
+ module OctopusAuth
2
+ class AccessScopeValidator
3
+ def initialize(access_token)
4
+ @access_token = access_token
5
+ @access_scopes = (access_token.access_scopes || '').split(OctopusAuth.configuration.access_scopes_delimiter)
6
+ end
7
+
8
+ def valid?(*required_scopes)
9
+ access_all_scopes? || required_scopes.all? { |scope| access_scopes.include?(scope.to_s) }
10
+ end
11
+
12
+ def self.valid?(access_token, *required_scopes)
13
+ self.new(access_token).valid?(*required_scopes)
14
+ end
15
+
16
+ private
17
+
18
+ attr_reader :access_token, :access_scopes
19
+
20
+ def access_all_scopes?
21
+ access_scopes.any? { |scope| scope == OctopusAuth.configuration.access_scopes_wildcard.to_s }
22
+ end
23
+ end
24
+ end
@@ -6,5 +6,7 @@ module OctopusAuth
6
6
  attr_accessor :token_length
7
7
  attr_accessor :model_class
8
8
  attr_accessor :model_readonly
9
+ attr_accessor :access_scopes_delimiter
10
+ attr_accessor :access_scopes_wildcard
9
11
  end
10
12
  end
@@ -1,3 +1,3 @@
1
1
  module OctopusAuth
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/tags ADDED
@@ -0,0 +1,66 @@
1
+ !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2
+ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3
+ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4
+ !_TAG_PROGRAM_NAME Exuberant Ctags //
5
+ !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
+ !_TAG_PROGRAM_VERSION 5.8 //
7
+ AccessScopeValidator lib/octopus_auth/access_scope_validator.rb /^ class AccessScopeValidator$/;" c class:OctopusAuth
8
+ Authenticator lib/octopus_auth/authenticator.rb /^ class Authenticator$/;" c class:OctopusAuth
9
+ ByScope lib/octopus_auth/queries/by_scope.rb /^ class ByScope$/;" c class:OctopusAuth.Queries
10
+ Configuration lib/octopus_auth/configuration.rb /^ class Configuration$/;" c class:OctopusAuth
11
+ Decorators lib/octopus_auth/decorators.rb /^ module Decorators$/;" m class:OctopusAuth
12
+ Decorators lib/octopus_auth/decorators/default.rb /^ module Decorators$/;" m class:OctopusAuth
13
+ Default lib/octopus_auth/decorators/default.rb /^ class Default$/;" c class:OctopusAuth.Decorators
14
+ Errors lib/octopus_auth/errors.rb /^ module Errors$/;" m class:OctopusAuth
15
+ Errors lib/octopus_auth/errors/token_not_found_error.rb /^ module Errors$/;" m class:OctopusAuth
16
+ Get lib/octopus_auth/queries/get.rb /^ class Get$/;" c class:OctopusAuth.Queries
17
+ Issue lib/octopus_auth/issue.rb /^ class Issue$/;" c class:OctopusAuth
18
+ MockAccessToken spec/spec_helper.rb /^class MockAccessToken$/;" c
19
+ OctopusAuth lib/octopus_auth.rb /^module OctopusAuth$/;" m
20
+ OctopusAuth lib/octopus_auth/access_scope_validator.rb /^module OctopusAuth$/;" m
21
+ OctopusAuth lib/octopus_auth/authenticator.rb /^module OctopusAuth$/;" m
22
+ OctopusAuth lib/octopus_auth/configuration.rb /^module OctopusAuth$/;" m
23
+ OctopusAuth lib/octopus_auth/decorators.rb /^module OctopusAuth$/;" m
24
+ OctopusAuth lib/octopus_auth/decorators/default.rb /^module OctopusAuth$/;" m
25
+ OctopusAuth lib/octopus_auth/errors.rb /^module OctopusAuth$/;" m
26
+ OctopusAuth lib/octopus_auth/errors/token_not_found_error.rb /^module OctopusAuth$/;" m
27
+ OctopusAuth lib/octopus_auth/issue.rb /^module OctopusAuth$/;" m
28
+ OctopusAuth lib/octopus_auth/queries.rb /^module OctopusAuth$/;" m
29
+ OctopusAuth lib/octopus_auth/queries/by_scope.rb /^module OctopusAuth$/;" m
30
+ OctopusAuth lib/octopus_auth/queries/get.rb /^module OctopusAuth$/;" m
31
+ OctopusAuth lib/octopus_auth/revoke.rb /^module OctopusAuth$/;" m
32
+ OctopusAuth lib/octopus_auth/token_generator.rb /^module OctopusAuth$/;" m
33
+ OctopusAuth lib/octopus_auth/version.rb /^module OctopusAuth$/;" m
34
+ Queries lib/octopus_auth/queries.rb /^ module Queries$/;" m class:OctopusAuth
35
+ Queries lib/octopus_auth/queries/by_scope.rb /^ module Queries$/;" m class:OctopusAuth
36
+ Queries lib/octopus_auth/queries/get.rb /^ module Queries$/;" m class:OctopusAuth
37
+ Revoke lib/octopus_auth/revoke.rb /^ class Revoke$/;" c class:OctopusAuth
38
+ TokenGenerator lib/octopus_auth/token_generator.rb /^ class TokenGenerator$/;" c class:OctopusAuth
39
+ TokenNotFoundError lib/octopus_auth/errors/token_not_found_error.rb /^ class TokenNotFoundError < StandardError$/;" c class:OctopusAuth.Errors
40
+ access_all_scopes? lib/octopus_auth/access_scope_validator.rb /^ def access_all_scopes?$/;" f class:OctopusAuth.AccessScopeValidator
41
+ active? spec/spec_helper.rb /^ def active?$/;" f class:MockAccessToken
42
+ authenticate lib/octopus_auth/authenticator.rb /^ def authenticate$/;" f class:OctopusAuth.Authenticator
43
+ build_success_result lib/octopus_auth/authenticator.rb /^ def build_success_result(access_token)$/;" f class:OctopusAuth.Authenticator
44
+ configure lib/octopus_auth.rb /^ def self.configure$/;" F
45
+ execute lib/octopus_auth/issue.rb /^ def execute$/;" f class:OctopusAuth.Issue
46
+ execute lib/octopus_auth/queries/by_scope.rb /^ def execute$/;" f class:OctopusAuth.Queries.ByScope
47
+ execute lib/octopus_auth/queries/get.rb /^ def execute$/;" f class:OctopusAuth.Queries.Get
48
+ execute lib/octopus_auth/revoke.rb /^ def execute$/;" f class:OctopusAuth.Revoke
49
+ filtered_scope lib/octopus_auth/issue.rb /^ def filtered_scope$/;" f class:OctopusAuth.Issue
50
+ filtered_scope lib/octopus_auth/queries/by_scope.rb /^ def filtered_scope$/;" f class:OctopusAuth.Queries.ByScope
51
+ generate lib/octopus_auth/token_generator.rb /^ def generate(length)$/;" f class:OctopusAuth.TokenGenerator
52
+ generate_token lib/octopus_auth/issue.rb /^ def generate_token$/;" f class:OctopusAuth.Issue
53
+ initialize lib/octopus_auth/access_scope_validator.rb /^ def initialize(access_token)$/;" f class:OctopusAuth.AccessScopeValidator
54
+ initialize lib/octopus_auth/authenticator.rb /^ def initialize(token, scope = nil)$/;" f class:OctopusAuth.Authenticator
55
+ initialize lib/octopus_auth/decorators/default.rb /^ def initialize(token_model)$/;" f class:OctopusAuth.Decorators.Default
56
+ initialize lib/octopus_auth/issue.rb /^ def initialize(scope, owner_type, owner_id, creator_id, expires_at: nil)$/;" f class:OctopusAuth.Issue
57
+ initialize lib/octopus_auth/queries/by_scope.rb /^ def initialize(scope, owner_type, owner_id)$/;" f class:OctopusAuth.Queries.ByScope
58
+ initialize lib/octopus_auth/queries/get.rb /^ def initialize(token)$/;" f class:OctopusAuth.Queries.Get
59
+ initialize lib/octopus_auth/revoke.rb /^ def initialize(access_token_value)$/;" f class:OctopusAuth.Revoke
60
+ relation lib/octopus_auth/queries/by_scope.rb /^ def relation$/;" f class:OctopusAuth.Queries.ByScope
61
+ reset lib/octopus_auth.rb /^ def self.reset$/;" F
62
+ to_h lib/octopus_auth/decorators/default.rb /^ def to_h$/;" f class:OctopusAuth.Decorators.Default
63
+ unique_token lib/octopus_auth/token_generator.rb /^ def unique_token$/;" f class:OctopusAuth.TokenGenerator
64
+ valid lib/octopus_auth/access_scope_validator.rb /^ def self.valid?(access_token, *required_scopes)$/;" F class:OctopusAuth.AccessScopeValidator
65
+ valid? lib/octopus_auth/access_scope_validator.rb /^ def valid?(*required_scopes)$/;" f class:OctopusAuth.AccessScopeValidator
66
+ valid? lib/octopus_auth/authenticator.rb /^ def valid?(access_token)$/;" f class:OctopusAuth.Authenticator
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopus_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TINYpulse Devops
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-07 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,6 +102,7 @@ files:
102
102
  - bin/console
103
103
  - bin/setup
104
104
  - lib/octopus_auth.rb
105
+ - lib/octopus_auth/access_scope_validator.rb
105
106
  - lib/octopus_auth/authenticator.rb
106
107
  - lib/octopus_auth/configuration.rb
107
108
  - lib/octopus_auth/decorators.rb
@@ -117,6 +118,7 @@ files:
117
118
  - lib/octopus_auth/version.rb
118
119
  - lib/tasks/generate.rb
119
120
  - octopus_auth.gemspec
121
+ - tags
120
122
  homepage: https://github.com/TINYhr/octopus_auth
121
123
  licenses:
122
124
  - MIT