omniauth-slack 2.1.2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/omniauth/strategies/slack.rb +25 -9
- data/lib/omniauth-slack/version.rb +1 -1
- data/lib/omniauth-slack.rb +1 -1
- 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: f79b8e67dacdd3e9030fe66dd61bcbc78d1544da
|
4
|
+
data.tar.gz: d0026c7cab03f2fefc77828b67ac3e981939280b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cc4341e62ce85da1d4d7bed36f3e8f858851309e1812518466520b215ec86173413f50bcf161dba3e4c1a7b476f3fe1455248524b596bd68f34dd6f7c4dd187
|
7
|
+
data.tar.gz: ab19de0c2cb9cec37898cfb0f9a42cccf3f544a98ba954e29d651ee60f3f422e5d0c301f1eb06dca2d3c97fd8bbebdb4dfd2c753fd85ca00689ad14e62090028
|
data/.gitignore
CHANGED
@@ -3,14 +3,13 @@ require 'omniauth/strategies/oauth2'
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
class Slack < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, 'slack'
|
6
7
|
|
7
|
-
option :
|
8
|
-
|
9
|
-
option :authorize_options, [ :scope, :team ]
|
8
|
+
option :authorize_options, [:scope, :team]
|
10
9
|
|
11
10
|
option :client_options, {
|
12
|
-
site:
|
13
|
-
token_url:
|
11
|
+
site: 'https://slack.com',
|
12
|
+
token_url: '/api/oauth.access'
|
14
13
|
}
|
15
14
|
|
16
15
|
option :auth_token_params, {
|
@@ -43,7 +42,16 @@ module OmniAuth
|
|
43
42
|
end
|
44
43
|
|
45
44
|
extra do
|
46
|
-
{
|
45
|
+
{
|
46
|
+
raw_info: raw_info,
|
47
|
+
user_info: user_info,
|
48
|
+
team_info: team_info,
|
49
|
+
web_hook_info: web_hook_info
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def raw_info
|
54
|
+
@raw_info ||= access_token.get('/api/auth.test').parsed
|
47
55
|
end
|
48
56
|
|
49
57
|
def user_info
|
@@ -51,11 +59,19 @@ module OmniAuth
|
|
51
59
|
end
|
52
60
|
|
53
61
|
def team_info
|
54
|
-
@team_info ||= access_token.get(
|
62
|
+
@team_info ||= access_token.get('/api/team.info').parsed
|
55
63
|
end
|
56
64
|
|
57
|
-
def
|
58
|
-
|
65
|
+
def web_hook_info
|
66
|
+
return {} unless incoming_webhook_allowed?
|
67
|
+
access_token.params['incoming_webhook']
|
68
|
+
end
|
69
|
+
|
70
|
+
def incoming_webhook_allowed?
|
71
|
+
return false unless options['scope']
|
72
|
+
webhooks_scopes = ['incoming-webhook']
|
73
|
+
scopes = options['scope'].split(',')
|
74
|
+
(scopes & webhooks_scopes).any?
|
59
75
|
end
|
60
76
|
end
|
61
77
|
end
|
data/lib/omniauth-slack.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'omniauth-slack/version'
|
2
|
-
require 'omniauth/strategies/slack'
|
2
|
+
require 'omniauth/strategies/slack'
|