mvpaas 0.1.0 → 0.1.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: 33cabdfbbacc35eff13d239719981f46bef67eca
4
- data.tar.gz: f7b0843bb294f8707e8c2aee33630880a4820c4d
3
+ metadata.gz: f9e494045d3518b66b6f0232a21b03c0e126d8c7
4
+ data.tar.gz: 35808ffef78a1a3aa1fa4dd559e2910fda8c0ed8
5
5
  SHA512:
6
- metadata.gz: 19088d8c050993466d9044b11c03434a42cc15e452ac0823f9b1d827c3fb90f5362527cc6c909b83f335d9c167d0527f80253e663e704291fe4d605d753de621
7
- data.tar.gz: eb8ac0838b5ab34ff2c2a0ca0829e4fa26e6d5deb464e4d6592d2f482ab9e6648cce5838c86b472320461fc011c112b4fb857fb4d224771e2a81b219ff796ee9
6
+ metadata.gz: 1bf44a3556d8d22194480a29acd9c7c0986673598bb98d221b099a1350bc80ad40a5d1cc052bedc047a3fd5515f6af08c71696c813f90bfbe6a36163e1467bdb
7
+ data.tar.gz: e90efd29651f1c8d15185851d71bbae1c8dca14ca4b4b1b8e9f80ce3cba5dea0b856696c1960c1e15b157b3c415538b211aff45a8783e23e1acd36dc27624689
data/lib/mvpaas/auth.rb CHANGED
@@ -1,13 +1,15 @@
1
1
  require 'jwt'
2
2
  require 'openssl'
3
+ require 'base64'
3
4
 
4
5
  module MVPaaS
5
6
  module Auth
6
7
 
7
8
  module_function
8
9
 
9
- def decode(token, secret)
10
- rsa_key = OpenSSL::PKey::RSA.new(secret,'').public_key
10
+ def decode(token, secret = nil)
11
+ decoded_secret = Base64.urlsafe_decode64(secret || ENV['MVPAAS_SECRET'])
12
+ rsa_key = OpenSSL::PKey::RSA.new(decoded_secret,'').public_key
11
13
  decoded_jwt = JWT.decode(token, rsa_key, true, algorithm: 'RS256')[0]
12
14
  {
13
15
  id: decoded_jwt['sub'],
@@ -1,3 +1,3 @@
1
1
  module MVPaaS
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mvpaas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Montgomery
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt