omniauth-wonderful-union 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3fdea3ac4b1200f5335e4003e4fe500e10d1d6a
|
4
|
+
data.tar.gz: dee9bc45c8e1b7865036c5b8e0240c01283be052
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d010175c85b828f3319c9892aadd85f1dc7cffaaa3b5edeb088f5dfe8d5de1420d8c1d821b16c331406d8e8c67cb04376dcdcdaf2f362ba4a5a28a18dde86124
|
7
|
+
data.tar.gz: d18d3c1c47c573326e103c2599c9c0f2b9a32555582f0e65ca83e68abeb22e5febde0edf6c3cb9cabc72dd71d1ca36c0c353c64163629d36caf3bad62315f8e0
|
@@ -4,15 +4,22 @@ require "multi_json"
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
6
|
class WonderfulUnion < OmniAuth::Strategies::OAuth2
|
7
|
-
SITE_URL = "https://my.wun.io"
|
7
|
+
SITE_URL = "https://my.wun.io".freeze
|
8
8
|
|
9
9
|
option :name, "wonderful_union"
|
10
10
|
|
11
|
-
option :client_options,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
option :client_options,
|
12
|
+
site: SITE_URL,
|
13
|
+
authorize_url: "#{SITE_URL}/oauth/authorize",
|
14
|
+
token_url: "#{SITE_URL}/oauth/token"
|
15
|
+
|
16
|
+
def authorize_params
|
17
|
+
super.tap do |params|
|
18
|
+
%w(scope client_options).each do |v|
|
19
|
+
params[v.to_sym] = request.params[v] if request.params[v]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
16
23
|
|
17
24
|
uid { raw_info["id"] }
|
18
25
|
|
@@ -8,22 +8,51 @@ describe OmniAuth::Strategies::WonderfulUnion do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
context "client options" do
|
11
|
-
let(:client_options) { subject.options.client_options }
|
11
|
+
let(:client_options) { subject.options.client_options }
|
12
12
|
|
13
|
-
it "has
|
13
|
+
it "has default name" do
|
14
14
|
expect(client_options.site).
|
15
15
|
to eq OmniAuth::Strategies::WonderfulUnion::SITE_URL
|
16
16
|
end
|
17
17
|
|
18
|
-
it "has
|
18
|
+
it "has default authorize url" do
|
19
19
|
expect(client_options.authorize_url).
|
20
20
|
to eq("https://my.wun.io/oauth/authorize")
|
21
21
|
end
|
22
22
|
|
23
|
-
it "has
|
23
|
+
it "has default token url" do
|
24
24
|
expect(client_options.token_url).
|
25
25
|
to eq("https://my.wun.io/oauth/token")
|
26
26
|
end
|
27
|
+
|
28
|
+
context "can be overridden" do
|
29
|
+
let(:client_options_strategy) do
|
30
|
+
described_class.new(
|
31
|
+
"A_KEY",
|
32
|
+
"A_SECRET",
|
33
|
+
client_options: {
|
34
|
+
site: "http://localhost:4000",
|
35
|
+
authorize_url: "http://localhost:5000/auth",
|
36
|
+
token_url: "http://localhost:6000/token"
|
37
|
+
}
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "for site" do
|
42
|
+
expect(client_options_strategy.options.client_options.site).
|
43
|
+
to eq("http://localhost:4000")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "for authorize url" do
|
47
|
+
expect(client_options_strategy.options.client_options.authorize_url).
|
48
|
+
to eq("http://localhost:5000/auth")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "for token url" do
|
52
|
+
expect(client_options_strategy.options.client_options.token_url).
|
53
|
+
to eq("http://localhost:6000/token")
|
54
|
+
end
|
55
|
+
end
|
27
56
|
end
|
28
57
|
|
29
58
|
context "info" do
|
@@ -37,8 +66,6 @@ describe OmniAuth::Strategies::WonderfulUnion do
|
|
37
66
|
private
|
38
67
|
|
39
68
|
def raw_info_hash
|
40
|
-
{
|
41
|
-
email: "foo@example.com",
|
42
|
-
}
|
69
|
+
{ email: "foo@example.com" }
|
43
70
|
end
|
44
71
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
$:.unshift File.expand_path(
|
2
|
-
$:.unshift File.expand_path(
|
3
|
-
require
|
1
|
+
$:.unshift File.expand_path("..", __FILE__)
|
2
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
3
|
+
require "simplecov"
|
4
4
|
SimpleCov.start
|
5
|
-
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
5
|
+
|
6
|
+
require "rspec"
|
7
|
+
require "rack/test"
|
8
|
+
require "webmock/rspec"
|
9
|
+
require "omniauth"
|
10
|
+
require "omniauth-wonderful-union"
|
11
|
+
require "climate_control"
|
10
12
|
|
11
13
|
RSpec.configure do |config|
|
12
14
|
config.include WebMock::API
|
13
15
|
config.include Rack::Test::Methods
|
14
|
-
config.extend
|
16
|
+
config.extend OmniAuth::Test::StrategyMacros, type: :strategy
|
15
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-wonderful-union
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Franco
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
@@ -167,3 +167,4 @@ summary: OmniAuth strategy for Wonderful Union
|
|
167
167
|
test_files:
|
168
168
|
- spec/omniauth/strategies/wonderful_union_spec.rb
|
169
169
|
- spec/spec_helper.rb
|
170
|
+
has_rdoc:
|