omniauth-edwith-oauth2 0.1.1 → 0.1.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: 39e0e4dd8c9e3f797a4418e7ee76829dfd16b540508ff318633b9b5d8d9b1d0d
4
- data.tar.gz: 54497bba3d352c529a95d97a32e281543e3b09d267e910f0132974f3d4d2cde1
3
+ metadata.gz: e6e33b39edbd303a48ced343d8e14db7dcec924c0bf1e8c60187d0e823602d0a
4
+ data.tar.gz: ccb2abc9987fb7c43c763f907ecfa7c15d421ec889dd46f670c47ff42c416205
5
5
  SHA512:
6
- metadata.gz: 8cb9b69a0b9febe8a14dfb5ca669c5339203b8c35da2e7b068925fce5094c469071a4c34bf941274a3fa289d60a6a512af523d7cbb6de00f2d99cf0ca4731bf1
7
- data.tar.gz: 10671f27094f712f390935a002b589d448db40a7576736496aeff12f84554276e09d2637c3bcbf00460ddc9f16ac8c97c5e009d341defc455e6d9ede077e7a34
6
+ metadata.gz: a7db60c4d74c99c0a975ef2277f1690f3adf15b8d8798c644fc584e4401de4b8ee617d69e4e196327bb595c7cf1cbfca03c6db4c5a402de8ab4927904d81eeeb
7
+ data.tar.gz: a7b019fe8f3eac4cfbf28741ec9af405ea29905ed653a3f58cd0e070cb933f2cee662710e59c7cade5682348998d3f49432ea3c29d206a1ed35c4c189b1b0f03
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module EdwithOauth2
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
6
6
 
@@ -45,7 +45,7 @@ module OmniAuth
45
45
  end
46
46
 
47
47
  def raw_info
48
- @raw_info ||= access_token.get(options.client_options[:user_info_url]).parsed
48
+ @raw_info ||= access_token.post(options.client_options[:user_info_url]).parsed
49
49
  end
50
50
 
51
51
  def authorize_params
@@ -53,6 +53,34 @@ module OmniAuth
53
53
  Hash[params.map { |k, v| [k, v.respond_to?(:call) ? v.call(request) : v] }]
54
54
  end
55
55
 
56
+ def build_access_token
57
+ verifier = request.params["code"]
58
+ clientId = options.client_id
59
+ clientSecret = options.client_secret
60
+ token_url = options.client_options[:token_url]
61
+
62
+ params = {:redirect_uri => callback_url}.merge(token_params.to_hash(:symbolize_keys => true))
63
+ params = {'grant_type' => 'authorization_code', 'code' => verifier}.merge(client.redirection_params).merge(params)
64
+ params = ::OAuth2::Authenticator.new(clientId, clientSecret, :request_body).apply(params)
65
+
66
+ opts = {:raise_errors => options[:raise_errors], :parse => params.delete(:parse)}
67
+ headers = params.delete(:headers) || {}
68
+
69
+ opts[:body] = params
70
+ opts[:headers] = {'Content-Type' => 'application/x-www-form-urlencoded'}
71
+ opts[:headers].merge!(headers)
72
+
73
+ response = client.request(:post, token_url, opts)
74
+
75
+ if options[:raise_errors] && !(response.parsed.is_a?(Hash))
76
+ error = Error.new(response)
77
+ raise(error)
78
+ end
79
+
80
+ access_token_opts = deep_symbolize(options.auth_token_params)
81
+ ::OAuth2::AccessToken.from_hash(client, response.parsed["data"].merge(access_token_opts))
82
+ end
83
+
56
84
  private
57
85
 
58
86
  def user_paths
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-edwith-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minhyeok Ju
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,7 @@ files:
72
72
  - lib/omniauth-edwith-oauth2.rb
73
73
  - lib/omniauth-edwith-oauth2/version.rb
74
74
  - lib/omniauth/strategies/edwith_oauth2.rb
75
+ - omniauth-edwith-oauth2-0.1.1.gem
75
76
  - omniauth-edwith-oauth2.gemspec
76
77
  homepage:
77
78
  licenses: []