discourse-omniauth-jwt-xsolla 0.2.3 → 0.2.4

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: f1e7e19f249836ea2fbc3f595681c364acc9c5dfa0a00d1dfc666957346c420d
4
- data.tar.gz: 1b124b4dbcd0f7d4c8c14ec8230e5a15f026a3c25dfe1d972befa21398f1a6ca
3
+ metadata.gz: a5c60ebd81184d7da0918713da0fc176392b96f0ff12f40fdebfc910863906d8
4
+ data.tar.gz: 8970fbc00f39f72e318b1316523249432769e82f943cd058cb46fffedf73e235
5
5
  SHA512:
6
- metadata.gz: b1decd5a5a6f0b7c5cac5e33b09ddf3f4998da68c12383a5ecdbebd9ed43838a19afdaf5520030d333cadfa3e76b1f9f382b9c0bcf9e2356d65b26928c9ac379
7
- data.tar.gz: edef9e7c613ca65d98e28dc51b9d3be6a3c25fc35e6a3ada93b14f4c4853e9555325c5af985bcbaf264fb8b4b1d49fe2fbd1a27f65a47496bf179935924f7fa3
6
+ metadata.gz: 1714dda51aa312f92d719eec40dbbaf970eca154c0992673dba92548079152b96c4dd34e000700660bb6c35c158b60806737e07461e24a89684372bb73b3843b
7
+ data.tar.gz: 1dde44a867b37331a04430c1e5e1ac09cd7aaa31271d36bf72b3f34eb8a7e6f51d9bc8fe03481d62e5e4243475b33a9acd32be3cdfba6e660b13ef556c490efb
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module JWT
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ require 'omniauth'
2
2
  require 'jwt'
3
3
  require 'net/http'
4
4
  require 'json'
5
+ require 'uri'
5
6
 
6
7
  module OmniAuth
7
8
  module Strategies
@@ -27,11 +28,20 @@ module OmniAuth
27
28
  def decoded
28
29
  @decoded ||= ::JWT.decode(request.params['token'], options.secret, false, {algorithm: options.algorithm})[0]
29
30
 
30
- uri = URI('https://login.xsolla.com/api/token/validate')
31
- req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
32
- req.body = {token: request.params['token']}.to_json
33
- res = Net::HTTP.start(uri.hostname, uri.port) do |http|
34
- http.request(req)
31
+ uri = URI.parse('https://login.xsolla.com/api/token/validate')
32
+
33
+ header = {'Content-Type': 'application/json'}
34
+ body = {token: request.params['token']}
35
+
36
+ # Create the HTTP objects
37
+ http = Net::HTTP.new(uri.host, uri.port)
38
+ request = Net::HTTP::Post.new(uri.request_uri, header)
39
+ request.body = body.to_json
40
+
41
+ # Send the request
42
+ res = http.request(request)
43
+
44
+
35
45
  raise ClaimInvalid.new("Token is not valid.") if res.code != '204'
36
46
 
37
47
  (options.required_claims || []).each do |field|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse-omniauth-jwt-xsolla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh