mumukit-auth 6.0.0 → 6.0.1

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
  SHA1:
3
- metadata.gz: 48132fd268d8f40d8688bf66aef5a6e0e59278fe
4
- data.tar.gz: 9e45f936fba26b66bfe45c72fd90fcb71801772b
3
+ metadata.gz: cad7de722471f7a3840c2f420fe03ba8cd3c7286
4
+ data.tar.gz: 2f46709c7ecb1d2523884472c364169b191820e1
5
5
  SHA512:
6
- metadata.gz: 3c7b2817a9f6fb208656b1e99ac1d360b7a2cdd3edcef2934d64fb6472715a6bb5c332c8a599491eb4c5170439c9b924bed969537f2fb48129fd61f22a4348f6
7
- data.tar.gz: e86d0036c462534995846c289154f7de22431dc42fbf093d3cc8b298532eb68d05beb7d33433b0fd4e822946c502ec503b4388d762a9c62a0c07332e0d090ac5
6
+ metadata.gz: 2cc66af3b03c90ec19971a2a782458c6a34d68be68693d96ed3a7321fd10b4631590b001cbb303ce9ae0d81f520938c1b24e6803046641196be0345cbf54eb0c
7
+ data.tar.gz: 7a28369311817b470176f726e31dc7b392a5fa564c1aba733ea41f7e6b97b08c8cc5fa5b105491d34d10f568dfb5fb3d4925e1e14a001b203d46e3db122779de
@@ -1,6 +1,5 @@
1
1
  require 'active_support/all'
2
2
  require 'mumukit/core'
3
- require 'daybreak'
4
3
  require 'jwt'
5
4
 
6
5
  require_relative './auth/array'
@@ -14,8 +13,6 @@ require_relative './auth/client'
14
13
  require_relative './auth/token'
15
14
  require_relative './auth/scope'
16
15
  require_relative './auth/permissions'
17
- require_relative './auth/store'
18
- require_relative './auth/permissions_persistence/daybreak'
19
16
 
20
17
  require 'ostruct'
21
18
 
@@ -32,7 +29,6 @@ module Mumukit
32
29
  id: ENV['MUMUKI_AUTH_CLIENT_ID'],
33
30
  secret: ENV['MUMUKI_AUTH_CLIENT_SECRET']
34
31
  }
35
- config.persistence_strategy = Mumukit::Auth::PermissionsPersistence::Daybreak.new
36
32
  end
37
33
  end
38
34
 
@@ -46,7 +46,7 @@ module Mumukit::Auth
46
46
  end
47
47
 
48
48
  def self.join(*parts)
49
- raise 'Slugs must have up to two parts' if parts.length > 2
49
+ raise Mumukit::Auth::InvalidSlugFormatError, 'Slugs must have up to two parts' if parts.length > 2
50
50
 
51
51
  if parts.first.is_a? Hash
52
52
  from_options parts.first
@@ -15,14 +15,6 @@ module Mumukit::Auth
15
15
  @uid ||= jwt['uid'] || jwt['email'] || jwt['sub']
16
16
  end
17
17
 
18
- def permissions
19
- @permissions ||= Mumukit::Auth::Store.get uid
20
- end
21
-
22
- def protect!(scope, resource_slug)
23
- permissions.protect! scope, resource_slug
24
- end
25
-
26
18
  def verify_client!
27
19
  raise Mumukit::Auth::InvalidTokenError.new('aud mismatch') if client.id != jwt['aud']
28
20
  end
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Auth
3
- VERSION = '6.0.0'
3
+ VERSION = '6.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: daybreak
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: mumukit-core
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -107,12 +93,10 @@ files:
107
93
  - lib/mumukit/auth/exceptions.rb
108
94
  - lib/mumukit/auth/grant.rb
109
95
  - lib/mumukit/auth/permissions.rb
110
- - lib/mumukit/auth/permissions_persistence/daybreak.rb
111
96
  - lib/mumukit/auth/role.rb
112
97
  - lib/mumukit/auth/roles.rb
113
98
  - lib/mumukit/auth/scope.rb
114
99
  - lib/mumukit/auth/slug.rb
115
- - lib/mumukit/auth/store.rb
116
100
  - lib/mumukit/auth/token.rb
117
101
  - lib/mumukit/auth/version.rb
118
102
  homepage: http://github.com/mumuki/mumukit-auth
@@ -1,29 +0,0 @@
1
- module Mumukit::Auth
2
- module PermissionsPersistence
3
- class Daybreak
4
- def initialize(db_name = 'permissions')
5
- @db_name = db_name
6
- at_exit { @db.close if @db }
7
- end
8
-
9
- def set!(key, value)
10
- db.update! key.to_sym => value.to_json
11
- db.flush
12
- end
13
-
14
- def get(key)
15
- Mumukit::Auth::Permissions.load db[key]
16
- end
17
-
18
- def clean!
19
- db.clear
20
- end
21
-
22
- private
23
-
24
- def db
25
- @db ||= ::Daybreak::DB.new "#{@db_name}.db", default: '{}'
26
- end
27
- end
28
- end
29
- end
@@ -1,19 +0,0 @@
1
- module Mumukit::Auth
2
- module Store
3
- def self.clean!
4
- persistence_strategy.clean!
5
- end
6
-
7
- def self.set!(*args)
8
- persistence_strategy.set!(*args)
9
- end
10
-
11
- def self.get(key)
12
- persistence_strategy.get(key)
13
- end
14
-
15
- def self.persistence_strategy
16
- Mumukit::Auth.config.persistence_strategy
17
- end
18
- end
19
- end