warden-github 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -0
- data/config.ru +1 -1
- data/lib/warden-github/strategy.rb +9 -1
- data/lib/warden-github/version.rb +1 -1
- data/spec/app.rb +4 -4
- metadata +4 -4
data/README.md
CHANGED
@@ -7,6 +7,11 @@ To test it out on localhost set your callback url to 'http://localhost:9292/auth
|
|
7
7
|
|
8
8
|
There's an example app in [spec/app.rb](/atmos/warden-github/blob/master/spec/app.rb).
|
9
9
|
|
10
|
+
Using with GitHub Enterprise
|
11
|
+
============================
|
12
|
+
|
13
|
+
Export the `OCTOKIT_API_ENDPOINT` environmental variable to the URL of your enterprise install.
|
14
|
+
|
10
15
|
The Extension in Action
|
11
16
|
=======================
|
12
17
|
% gem install bundler
|
data/config.ru
CHANGED
@@ -54,7 +54,7 @@ Warden::Strategies.add(:github) do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def user_info_for(token)
|
57
|
-
@user_info ||= RestClient.get("
|
57
|
+
@user_info ||= RestClient.get(github_api_uri + "/user", :params => {:access_token => token})
|
58
58
|
end
|
59
59
|
|
60
60
|
def callback_url
|
@@ -72,4 +72,12 @@ Warden::Strategies.add(:github) do
|
|
72
72
|
proto = "http" if proto.nil?
|
73
73
|
"#{proto}://#{request.host}#{port_part}#{suffix}"
|
74
74
|
end
|
75
|
+
|
76
|
+
def github_api_uri
|
77
|
+
if ENV['OCTOKIT_API_ENDPOINT']
|
78
|
+
ENV['OCTOKIT_API_ENDPOINT']
|
79
|
+
else
|
80
|
+
"https://api.github.com"
|
81
|
+
end
|
82
|
+
end
|
75
83
|
end
|
data/spec/app.rb
CHANGED
@@ -13,7 +13,7 @@ module Example
|
|
13
13
|
manager[:github_client_id] = ENV['GITHUB_CLIENT_ID'] || 'ee9aa24b64d82c21535a'
|
14
14
|
manager[:github_secret] = ENV['GITHUB_CLIENT_SECRET'] || 'ed8ff0c54067aefb808dab1ca265865405d08d6f'
|
15
15
|
|
16
|
-
manager[:github_scopes] = '
|
16
|
+
manager[:github_scopes] = ''
|
17
17
|
manager[:github_oauth_domain] = ENV['GITHUB_OAUTH_DOMAIN'] || 'https://github.com'
|
18
18
|
manager[:github_callback_url] = '/auth/github/callback'
|
19
19
|
end
|
@@ -34,9 +34,9 @@ module Example
|
|
34
34
|
ensure_authenticated
|
35
35
|
<<-EOS
|
36
36
|
<h2>Hello There, #{user.name}!</h2>
|
37
|
-
<h3>Rails Org Member: #{user.organization_member?('
|
38
|
-
<h3>Publicized Rails Org Member: #{user.publicized_organization_member?('
|
39
|
-
<h3>Rails Committer Team Member: #{user.team_member?(
|
37
|
+
<h3>Rails Org Member: #{user.organization_member?('rails')}.</h3>
|
38
|
+
<h3>Publicized Rails Org Member: #{user.publicized_organization_member?('rails')}.</h3>
|
39
|
+
<h3>Rails Committer Team Member: #{user.team_member?(632)}.</h3>
|
40
40
|
EOS
|
41
41
|
end
|
42
42
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warden-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 45
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 12
|
9
|
-
-
|
10
|
-
version: 0.12.
|
9
|
+
- 1
|
10
|
+
version: 0.12.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Corey Donohoe
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-01-28 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|