omniauth-clever 1.2.0 → 1.2.1
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 +4 -4
- data/README.md +6 -1
- data/lib/omniauth/clever/version.rb +1 -1
- data/lib/omniauth/strategies/clever.rb +24 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66fffece22d76f800d950c85b783f41f5879bfad
|
4
|
+
data.tar.gz: 05ccd3ee2aad3d7b5f443c53de7fc995f2e780e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15eec45d3d127ed0c77266692be1c75e6c7db2e5341f93e38e47b80d6071ad117fa9fb793f33afa6eb9a9a9d0fa46ece7bac407d5d01accef8f00d22f9ae8049
|
7
|
+
data.tar.gz: 0aa20f2e688be841911850a15a4dd032bd418c7e58e356cb1a5f41a01345772d1b29806adfe5c2deee8929cdfab9a185267c6b80f463050802259c8a14d11309
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Unofficial OmniAuth strategy for [Clever SSO OAuth2](https://dev.clever.com/sso)
|
|
6
6
|
|
7
7
|
Add the gem to your application's Gemfile:
|
8
8
|
|
9
|
-
gem 'omniauth-clever', '~> 1.2.
|
9
|
+
gem 'omniauth-clever', '~> 1.2.1'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -28,6 +28,11 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
28
28
|
end
|
29
29
|
```
|
30
30
|
|
31
|
+
Clever is a unique OAuth 2.0 service provider in that login sequences
|
32
|
+
are often initiated by Clever, not the client. When Clever initiates
|
33
|
+
login, a state parameter is not relevant nor sent.
|
34
|
+
|
35
|
+
|
31
36
|
## Configuring
|
32
37
|
|
33
38
|
To be able to set the optional `district_id` parameter on a
|
@@ -4,21 +4,43 @@ require 'base64'
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
6
|
class Clever < OmniAuth::Strategies::OAuth2
|
7
|
-
|
7
|
+
# Clever is a unique OAuth 2.0 service provider in that login sequences
|
8
|
+
# are often initiated by Clever, not the client. When Clever initiates
|
9
|
+
# login, a state parameter is not relevant nor sent.
|
8
10
|
|
11
|
+
option :name, "clever"
|
9
12
|
option :client_options, {
|
10
13
|
:site => 'https://api.clever.com',
|
11
14
|
:authorize_url => 'https://clever.com/oauth/authorize',
|
12
15
|
:token_url => 'https://clever.com/oauth/tokens'
|
13
16
|
}
|
14
17
|
|
18
|
+
# This option bubbles up to the OmniAuth::Strategies::OAuth2
|
19
|
+
# when we call super in the callback_phase below.
|
20
|
+
# **State will still be verified** when login is initiated by the client.
|
21
|
+
option :provider_ignores_state, true
|
22
|
+
|
15
23
|
def token_params
|
16
24
|
super.tap do |params|
|
17
25
|
params[:headers] = {'Authorization' => "Basic #{Base64.strict_encode64("#{options.client_id}:#{options.client_secret}")}"}
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
21
|
-
|
29
|
+
def callback_phase
|
30
|
+
error = request.params["error_reason"] || request.params["error"]
|
31
|
+
stored_state = session.delete("omniauth.state")
|
32
|
+
if error
|
33
|
+
fail!(error, CallbackError.new(request.params["error"], request.params["error_description"] || request.params["error_reason"], request.params["error_uri"]))
|
34
|
+
else
|
35
|
+
# Only verify state if we've initiated login and have stored a state
|
36
|
+
# to compare to.
|
37
|
+
if stored_state && (!request.params["state"] || request.params["state"] != stored_state)
|
38
|
+
fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected"))
|
39
|
+
else
|
40
|
+
super
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
22
44
|
|
23
45
|
uid{ raw_info['data']['id'] }
|
24
46
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-clever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carol Nichols
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- gem-public_cert.pem
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: omniauth-oauth2
|
@@ -71,3 +71,4 @@ specification_version: 4
|
|
71
71
|
summary: The unofficial strategy for authenticating people using clever.com to your
|
72
72
|
application using Clever's OAuth2 provider
|
73
73
|
test_files: []
|
74
|
+
has_rdoc:
|