slack_sign_in 0.1.0 → 0.1.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/app/controllers/slack_sign_in/application_controller.rb +1 -1
- data/app/controllers/slack_sign_in/authorizations_controller.rb +1 -1
- data/lib/slack_sign_in.rb +1 -1
- data/lib/slack_sign_in/engine.rb +2 -0
- data/lib/slack_sign_in/minitest.rb +15 -0
- data/lib/slack_sign_in/test_client.rb +45 -0
- data/lib/slack_sign_in/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3eedae0b2cfe987cb083c1d056a144fc8ce9f408254bbfed065662c1ac7841e
|
4
|
+
data.tar.gz: f50afab462ee8c2d3c0990dad9809d6abd2ddf9503abb13db166588175eb8af0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53e178b38f88ec229c38ae8771aef4e414c9cffe0d69e26374686aa2b14d37f52a86a5355334b8fc1ee20232a5142fd2a4e40655984855047cab350272b245fd
|
7
|
+
data.tar.gz: 3b8e0e581c982d2609bc2e8f664f16ba2fcc44380961725cc59d079f59f0a4b24adc09fd0948f941345d87c61325021c77f03a48c542a0ac66fd4ad2660731b8
|
data/README.md
CHANGED
@@ -16,6 +16,8 @@ This project adheres to the Contributor Covenant
|
|
16
16
|
uphold this code. Please report unacceptable behavior to
|
17
17
|
research@teecom.com.
|
18
18
|
|
19
|
+
In addition to the documentation here, we also have a **[Getting Started with `slack_sign_in`](https://vimeo.com/387819353)** video :movie_camera:.
|
20
|
+
|
19
21
|
## Installation
|
20
22
|
|
21
23
|
Add `slack_sign_in` to your Rails app's Gemfile and run `bundle install`:
|
data/Rakefile
CHANGED
data/lib/slack_sign_in.rb
CHANGED
data/lib/slack_sign_in/engine.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "oauth2"
|
2
|
+
require "slack_sign_in/test_client"
|
2
3
|
|
3
4
|
module SlackSignIn
|
4
5
|
class Engine < ::Rails::Engine
|
@@ -11,6 +12,7 @@ module SlackSignIn
|
|
11
12
|
SlackSignIn.client_id = config.slack_sign_in.client_id || app.credentials.dig(:slack_sign_in, :client_id)
|
12
13
|
SlackSignIn.client_secret = config.slack_sign_in.client_secret || app.credentials.dig(:slack_sign_in, :client_secret)
|
13
14
|
SlackSignIn.scopes = config.slack_sign_in.scopes || SlackSignIn::DEFAULT_SCOPES
|
15
|
+
SlackSignIn.client = config.slack_sign_in.client || OAuth2::Client
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "minitest/mock"
|
2
|
+
|
3
|
+
module SlackSignIn::SystemTestHelpers
|
4
|
+
def mock_successful_authorization(identity_info, &block)
|
5
|
+
SlackSignIn::TestClient.stub(
|
6
|
+
:identity_info,
|
7
|
+
SlackSignIn::TestClient.identity_info.merge(identity_info),
|
8
|
+
&block
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def mock_failed_authorization(error, &block)
|
13
|
+
SlackSignIn::TestClient.stub(:error_code, error, &block)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module SlackSignIn
|
2
|
+
class TestClient
|
3
|
+
def self.error_code
|
4
|
+
nil
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.identity_info
|
8
|
+
{
|
9
|
+
team_id: "team_id_123",
|
10
|
+
user_id: "user_id_123",
|
11
|
+
user: {
|
12
|
+
name: "Example User",
|
13
|
+
email: "example@email.com",
|
14
|
+
image_48: "http://avatar.com",
|
15
|
+
},
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(_, _, authorize_url:, token_url:, redirect_uri:)
|
20
|
+
@redirect_uri = redirect_uri
|
21
|
+
end
|
22
|
+
|
23
|
+
def auth_code
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def authorize_url(scope:, state:)
|
28
|
+
base_url = @redirect_uri + "?state=#{state}&"
|
29
|
+
|
30
|
+
if (error = self.class.error_code)
|
31
|
+
base_url + "&error=#{error}"
|
32
|
+
else
|
33
|
+
base_url + "&code=123"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_token(_)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def params
|
42
|
+
self.class.identity_info
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_sign_in
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Schaefer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -113,6 +113,8 @@ files:
|
|
113
113
|
- config/routes.rb
|
114
114
|
- lib/slack_sign_in.rb
|
115
115
|
- lib/slack_sign_in/engine.rb
|
116
|
+
- lib/slack_sign_in/minitest.rb
|
117
|
+
- lib/slack_sign_in/test_client.rb
|
116
118
|
- lib/slack_sign_in/version.rb
|
117
119
|
homepage: https://github.com/teecom/slack_sign_in
|
118
120
|
licenses:
|
@@ -129,11 +131,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
131
|
version: '0'
|
130
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
133
|
requirements:
|
132
|
-
- - "
|
134
|
+
- - ">"
|
133
135
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
136
|
+
version: 1.3.1
|
135
137
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.1.2
|
137
139
|
signing_key:
|
138
140
|
specification_version: 4
|
139
141
|
summary: Sign in (or up) with Slack for Rails applications
|