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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/octopus_auth.rb +1 -0
- data/lib/octopus_auth/access_scope_validator.rb +24 -0
- data/lib/octopus_auth/configuration.rb +2 -0
- data/lib/octopus_auth/version.rb +1 -1
- data/tags +66 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ec4eccfedfb4439c5992d1f1b68aef4d7c6c9bc0172ddc544c125964f8f441b
|
4
|
+
data.tar.gz: 346c819627d1e06682a4bab819c1686cfad0ae2cd1a56f17c227fc1ae88e9af6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72055e00a839c206acd9865d74751091b0aed518801bacba788293866b24612a9ac012efa29e8d1bb1a0c411d16f60dd446d19ba88d359f6da14bea70201178b
|
7
|
+
data.tar.gz: 2da237a783db8a4f69aa38d74642277878bf0eed5bace48313c3db3a492de3bdf5fd0ef30bebeb1d1b7b443192a80db8b4496dcfbe79024ecfcdc12675cf7b5f
|
data/Gemfile.lock
CHANGED
data/lib/octopus_auth.rb
CHANGED
@@ -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
|
data/lib/octopus_auth/version.rb
CHANGED
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.
|
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-
|
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
|