sinatra_omniauth 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sinatra/omniauth.rb +9 -1
- data/models/authentication.rb +3 -3
- data/omniauth.yml +12 -10
- data/sinatra_omniauth.gemspec +1 -1
- data/views/auth.haml +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/sinatra/omniauth.rb
CHANGED
@@ -156,6 +156,14 @@ module SinatraOmniAuth
|
|
156
156
|
end
|
157
157
|
|
158
158
|
app.get '/auth/:authentication/callback' do
|
159
|
+
callback
|
160
|
+
end
|
161
|
+
|
162
|
+
app.post '/auth/:authentication/callback' do
|
163
|
+
callback
|
164
|
+
end
|
165
|
+
|
166
|
+
app.send(:define_method, :callback) do
|
159
167
|
# callback: success
|
160
168
|
# This handles signing in and adding an authentication authentication to existing accounts itself
|
161
169
|
|
@@ -173,7 +181,7 @@ module SinatraOmniAuth
|
|
173
181
|
|
174
182
|
# create a new regularised authentication hash
|
175
183
|
@authhash = Hash.new
|
176
|
-
oaeuh = omniauth['extra']['user_hash']
|
184
|
+
oaeuh = omniauth['extra'] && omniauth['extra']['user_hash']
|
177
185
|
oaui = omniauth['user_info']
|
178
186
|
if authentication_route == 'facebook'
|
179
187
|
@authhash[:email] = oaeuh['email'] || ''
|
data/models/authentication.rb
CHANGED
@@ -6,7 +6,7 @@ class Authentication
|
|
6
6
|
property :id, Serial
|
7
7
|
property :user_id, Integer
|
8
8
|
property :provider, String
|
9
|
-
property :uid, String
|
10
|
-
property :user_name, String
|
11
|
-
property :user_email, String
|
9
|
+
property :uid, String, :length => 240
|
10
|
+
property :user_name, String, :length => 240
|
11
|
+
property :user_email, String, :length => 240
|
12
12
|
end
|
data/omniauth.yml
CHANGED
@@ -11,9 +11,12 @@
|
|
11
11
|
name: Facebook
|
12
12
|
key: "--- enter your key here ---"
|
13
13
|
secret: --- enter your secret here ---
|
14
|
-
client_options:
|
15
|
-
ssl:
|
16
|
-
|
14
|
+
:client_options:
|
15
|
+
:ssl:
|
16
|
+
# For OS/X:
|
17
|
+
:ca_file: /opt/local/etc/ssl/certs/ca-certificates.crt
|
18
|
+
# For Linux:
|
19
|
+
# :ca_file: /etc/ssl/certs
|
17
20
|
|
18
21
|
-
|
19
22
|
provider: google
|
@@ -35,24 +38,24 @@
|
|
35
38
|
name: GitHub
|
36
39
|
key: --- enter your key here ---
|
37
40
|
secret: --- enter your secret here ---
|
41
|
+
:client_options:
|
42
|
+
:ssl:
|
43
|
+
# For OS/X:
|
44
|
+
:ca_file: /opt/local/etc/ssl/certs/ca-certificates.crt
|
45
|
+
# For Linux:
|
46
|
+
# :ca_file: /etc/ssl/certs
|
38
47
|
|
39
48
|
-
|
40
49
|
provider: openid
|
41
50
|
# Generic OpenID:
|
42
51
|
name: OpenID
|
43
52
|
store: ./tmp
|
44
|
-
key: --- enter your key here ---
|
45
|
-
secret: --- enter your secret here ---
|
46
|
-
|
47
53
|
|
48
54
|
-
|
49
55
|
provider: openid
|
50
56
|
name: MyOpenID
|
51
57
|
store: ./tmp
|
52
58
|
identifier: 'myopenid.com'
|
53
|
-
key: --- enter your key here ---
|
54
|
-
secret: --- enter your secret here ---
|
55
|
-
|
56
59
|
|
57
60
|
-
|
58
61
|
provider: openid
|
@@ -61,7 +64,6 @@
|
|
61
64
|
key: --- enter your key here ---
|
62
65
|
secret: --- enter your secret here ---
|
63
66
|
|
64
|
-
|
65
67
|
-
|
66
68
|
provider: openid
|
67
69
|
name: AOL
|
data/sinatra_omniauth.gemspec
CHANGED
data/views/auth.haml
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
- if @authentications_possible.size > 0
|
40
40
|
.clear
|
41
41
|
- @authentications_possible.each do |authentication|
|
42
|
-
.authentication{:style=>"background-image: url(/images/authbuttons/#{authentication['provider']}_32.png)",:onclick=>"location = '/auth/#{authentication['provider']}';"}
|
42
|
+
.authentication{:style=>"background-image: url(/images/authbuttons/#{authentication['provider']}_32.png)",:onclick=>"location = '/auth/#{(a = authentication['provider']) == 'openid' ? authentication['name'].downcase : a}';"}
|
43
43
|
.provider= authentication['name']
|
44
44
|
- if !current_user
|
45
45
|
%p.clear
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra_omniauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Clifford Heath
|