omniauth-icos 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth-icos/version.rb +1 -1
- data/lib/omniauth/strategies/icos.rb +1 -35
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b795896cd4905a2cd4b3d8cb0989c66a1164af05
|
4
|
+
data.tar.gz: 4500f59056f0f1da1fa7c6360ddb1e44acf3d19a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e62ad39e09309713180da76ae5b7afff296775f0d7d29ac00257684514b55208fe2e24f01ca17a538b92d2155aac3ac9f6345782421478d46b89666af2a241cd
|
7
|
+
data.tar.gz: 0f57e4afcda78a7025ac155260a9ac6453a1b18d07915c2a98ab3e83a9862578979c19b2bd05a80778418ce3c6e97fd568b999b50fe8b85f5405cf5f445da97e
|
@@ -11,7 +11,7 @@ module OmniAuth
|
|
11
11
|
|
12
12
|
option :client_options, {
|
13
13
|
authorize_url: '/oauth2/auth',
|
14
|
-
token_url: '/
|
14
|
+
token_url: '/oauth2/token',
|
15
15
|
site: 'https://icosid.com'
|
16
16
|
}
|
17
17
|
|
@@ -63,40 +63,6 @@ module OmniAuth
|
|
63
63
|
options[:redirect_uri] || (full_host + script_name + callback_path)
|
64
64
|
end
|
65
65
|
|
66
|
-
def build_access_token
|
67
|
-
params = ::OAuth2::Authenticator.new(client.id, client.secret, :request_body).apply(
|
68
|
-
{
|
69
|
-
'Redirect' => callback_url,
|
70
|
-
'ClientId' => options[:client_id],
|
71
|
-
'ClientSecret' => options[:client_secret],
|
72
|
-
'Scopes' => DEFAULT_SCOPES,
|
73
|
-
'Code' => request.params['code']
|
74
|
-
}
|
75
|
-
)
|
76
|
-
|
77
|
-
opts = {
|
78
|
-
:raise_errors => options[:raise_errors],
|
79
|
-
:parse => params.delete(:parse),
|
80
|
-
:body => params,
|
81
|
-
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' }
|
82
|
-
}
|
83
|
-
|
84
|
-
headers = params.delete(:headers) || {}
|
85
|
-
opts[:headers].merge!(headers)
|
86
|
-
|
87
|
-
response = client.request(:post, client.token_url, opts)
|
88
|
-
|
89
|
-
if !response.parsed.is_a?(Hash) || !response.parsed['Result'] || !response.parsed['Result']['access_token']
|
90
|
-
error = ::OmniAuth::Error.new(response)
|
91
|
-
raise(error)
|
92
|
-
end
|
93
|
-
|
94
|
-
body = response.parsed['Result']
|
95
|
-
body['expires_at'] = body['expiry'].to_datetime.in_time_zone
|
96
|
-
|
97
|
-
::OAuth2::AccessToken.from_hash(client, body)
|
98
|
-
end
|
99
|
-
|
100
66
|
def compact_full_name
|
101
67
|
[user_info['FirstName'], user_info['MiddleName'], user_info['LastName']].reject { |name| name.empty? }.join(' ')
|
102
68
|
end
|