osso 0.0.3.1 → 0.0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c702f0d417b5fdd0b2094303b1169b7095cf5b9b7a511086d51a4fd598ffd8e4
4
- data.tar.gz: 5e26b9ce26e67a131a431f9bd9778d63bd6f6b1194aa06ffebc9e915312fa442
3
+ metadata.gz: 5436cc4ffd1836ba000cdea128e83432cc94528d49ab407110fcacf7df05895d
4
+ data.tar.gz: c84623f25ff2893b0d7aeec78d6d9cfc28294c194abfaff2fc7e80862de0a70f
5
5
  SHA512:
6
- metadata.gz: c58931d540f6f61140ae9708ec2c80b470274fb85c47cfc96eed440ae01da94adb1f5987be679f9aa20c17d20f22901bed550943447a1505d5073bb07730ba67
7
- data.tar.gz: 56d28d4f79ae450c18759b400d2ce02aabad61775f930994ce84533da8ec589d43c8173bfe7f31a919d4c555d04da7c3852ebc5cc6c01f0946ecbabf83051c1d
6
+ metadata.gz: 854fbac14e9d96122b17af1de627bfb21a70a2f055edf7d9bda2179cd246f19e233b34fc468da9ff59b1a62271b7faaa2a5450c853c6c518d9531f62d4218475
7
+ data.tar.gz: e6df4b4874341659bb60704a9bfa1ddadf703b86ff0629c8174ac9bc83ceec019dc07d74e67f5cff71871c7f32dc7ea29a3a1959cb7a07f782ac8cc58fb9f9f5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osso (0.0.3.1)
4
+ osso (0.0.3.2)
5
5
  activesupport (>= 6.0.3.2)
6
6
  jwt
7
7
  omniauth-multi-provider
@@ -1,67 +1,69 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Helpers
4
- module Auth
5
- attr_accessor :current_scope
6
-
7
- def enterprise_protected!(domain = nil)
8
- return if admin_authorized?
9
- return if enterprise_authorized?(domain)
3
+ module Osso
4
+ module Helpers
5
+ module Auth
6
+ attr_accessor :current_scope
7
+
8
+ def enterprise_protected!(domain = nil)
9
+ return if admin_authorized?
10
+ return if enterprise_authorized?(domain)
10
11
 
11
- redirect ENV['JWT_URL']
12
- end
12
+ redirect ENV['JWT_URL']
13
+ end
13
14
 
14
- def enterprise_authorized?(domain)
15
- payload, _args = JWT.decode(
16
- token,
17
- ENV['JWT_HMAC_SECRET'],
18
- true,
19
- { algorithm: 'HS256' },
20
- )
15
+ def enterprise_authorized?(domain)
16
+ payload, _args = JWT.decode(
17
+ token,
18
+ ENV['JWT_HMAC_SECRET'],
19
+ true,
20
+ { algorithm: 'HS256' },
21
+ )
21
22
 
22
- @current_scope = payload['scope']
23
+ @current_scope = payload['scope']
23
24
 
24
- true
25
- rescue JWT::DecodeError
26
- false
27
- end
25
+ true
26
+ rescue JWT::DecodeError
27
+ false
28
+ end
28
29
 
29
- def admin_protected!
30
- return if admin_authorized?
30
+ def admin_protected!
31
+ return if admin_authorized?
31
32
 
32
- redirect ENV['JWT_URL']
33
- end
33
+ redirect ENV['JWT_URL']
34
+ end
34
35
 
35
- def admin_authorized?
36
- payload, _args = JWT.decode(
37
- token,
38
- ENV['JWT_HMAC_SECRET'],
39
- true,
40
- { algorithm: 'HS256' },
41
- )
36
+ def admin_authorized?
37
+ payload, _args = JWT.decode(
38
+ token,
39
+ ENV['JWT_HMAC_SECRET'],
40
+ true,
41
+ { algorithm: 'HS256' },
42
+ )
42
43
 
43
- if payload['scope'] == 'admin'
44
- @current_scope = :admin
45
- return true
46
- end
44
+ if payload['scope'] == 'admin'
45
+ @current_scope = :admin
46
+ return true
47
+ end
47
48
 
48
- false
49
- rescue JWT::DecodeError
50
- false
51
- end
49
+ false
50
+ rescue JWT::DecodeError
51
+ false
52
+ end
52
53
 
53
- def token
54
- request.env['admin_token'] || session['admin_token'] || request['admin_token']
55
- end
54
+ def token
55
+ request.env['admin_token'] || session['admin_token'] || request['admin_token']
56
+ end
56
57
 
57
- def chomp_token
58
- return unless request['admin_token'].present?
58
+ def chomp_token
59
+ return unless request['admin_token'].present?
59
60
 
60
- session['admin_token'] = request['admin_token']
61
+ session['admin_token'] = request['admin_token']
61
62
 
62
- return if request.post?
63
+ return if request.post?
63
64
 
64
- redirect request.path
65
+ redirect request.path
66
+ end
65
67
  end
66
68
  end
67
- end
69
+ end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Helpers
3
+ module Osso
4
+ module Helpers
5
+ end
4
6
  end
5
7
 
6
8
  require_relative 'auth'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Osso
4
- VERSION = '0.0.3.1'
4
+ VERSION = '0.0.3.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.1
4
+ version: 0.0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
@@ -297,7 +297,6 @@ files:
297
297
  - spec/routes/auth_spec.rb
298
298
  - spec/routes/oauth_spec.rb
299
299
  - spec/spec_helper.rb
300
- - spec/support/views/public/index.erb
301
300
  homepage: https://github.com/enterprise-oss/osso-rb
302
301
  licenses:
303
302
  - MIT
@@ -1,5 +0,0 @@
1
- <%#
2
- NB: this file exists so that the admin routes have something to render in spec.
3
- In real-world usage, those routes render an index.html file that includes the
4
- React app.
5
- %>