RubyApp 0.6.36 → 0.6.38
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ruby_app/elements/mobile/default/features/authentications/default_page.rb +5 -10
- data/lib/ruby_app/elements/mobile/document.rb +10 -0
- data/lib/ruby_app/elements/mobile/documents/authentication/facebook/authentication_document.rb +9 -7
- data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb +6 -4
- data/lib/ruby_app/elements/mobile/documents/authentication/open_id/authentication_document.rb +6 -4
- data/lib/ruby_app/version.rb +1 -1
- metadata +4 -4
@@ -30,32 +30,27 @@ module RubyApp
|
|
30
30
|
|
31
31
|
@github_authentication_link = RubyApp::Elements::Mobile::Button.new
|
32
32
|
@github_authentication_link.clicked do |element, event|
|
33
|
-
RubyApp::
|
34
|
-
event.refresh_browser
|
33
|
+
RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.new.show(event)
|
35
34
|
end
|
36
35
|
|
37
36
|
@facebook_authentication_link = RubyApp::Elements::Mobile::Button.new
|
38
37
|
@facebook_authentication_link.clicked do |element, event|
|
39
|
-
RubyApp::
|
40
|
-
event.refresh_browser
|
38
|
+
RubyApp::Elements::Mobile::Documents::Authentication::Facebook::EmailAuthenticationDocument.new.show(event)
|
41
39
|
end
|
42
40
|
|
43
41
|
@google_authentication_link = RubyApp::Elements::Mobile::Button.new
|
44
42
|
@google_authentication_link.clicked do |element, event|
|
45
|
-
RubyApp::
|
46
|
-
event.refresh_browser
|
43
|
+
RubyApp::Elements::Mobile::Documents::Authentication::OpenId::GoogleAuthenticationDocument.new.show(event)
|
47
44
|
end
|
48
45
|
|
49
46
|
@my_open_id_authentication_link = RubyApp::Elements::Mobile::Button.new
|
50
47
|
@my_open_id_authentication_link.clicked do |element, event|
|
51
|
-
RubyApp::
|
52
|
-
event.refresh_browser
|
48
|
+
RubyApp::Elements::Mobile::Documents::Authentication::OpenId::MyOpenIdAuthenticationDocument.new.show(event)
|
53
49
|
end
|
54
50
|
|
55
51
|
@yahoo_authentication_link = RubyApp::Elements::Mobile::Button.new
|
56
52
|
@yahoo_authentication_link.clicked do |element, event|
|
57
|
-
RubyApp::
|
58
|
-
event.refresh_browser
|
53
|
+
RubyApp::Elements::Mobile::Documents::Authentication::OpenId::YahooAuthenticationDocument.new.show(event)
|
59
54
|
end
|
60
55
|
|
61
56
|
end
|
@@ -57,6 +57,16 @@ module RubyApp
|
|
57
57
|
return @pages.last
|
58
58
|
end
|
59
59
|
|
60
|
+
def show(event, url = '/')
|
61
|
+
RubyApp::Session.documents.push(self)
|
62
|
+
event.go(url)
|
63
|
+
end
|
64
|
+
|
65
|
+
def hide(event, url = '/')
|
66
|
+
RubyApp::Session.documents.pop
|
67
|
+
event.go(url)
|
68
|
+
end
|
69
|
+
|
60
70
|
protected
|
61
71
|
|
62
72
|
def on_event(event)
|
data/lib/ruby_app/elements/mobile/documents/authentication/facebook/authentication_document.rb
CHANGED
@@ -25,7 +25,6 @@ module RubyApp
|
|
25
25
|
super()
|
26
26
|
|
27
27
|
self.loaded do |element, event|
|
28
|
-
|
29
28
|
unless @authentication
|
30
29
|
RubyApp::Log.debug("FACEBOOK permissions=#{permissions.inspect}")
|
31
30
|
@authentication = ::Koala::Facebook::OAuth.new(ENV['FACEBOOK_ACCESS_KEY'] || RubyApp::Elements::Mobile::Documents::Authentication::Facebook::AuthenticationDocument.configuration.access_key,
|
@@ -40,17 +39,20 @@ module RubyApp
|
|
40
39
|
code = RubyApp::Request.query['code']
|
41
40
|
token = @authentication.get_access_token(code)
|
42
41
|
RubyApp::Log.debug("FACEBOOK token=#{token.inspect}")
|
43
|
-
|
44
|
-
|
45
|
-
RubyApp::Log.debug("FACEBOOK me=#{me.inspect}")
|
46
|
-
RubyApp::Session.identity = self.create_identity_from_me(me)
|
47
|
-
RubyApp::Session.documents.pop
|
48
|
-
event.go('/')
|
42
|
+
self.process_token(token)
|
43
|
+
self.hide(event)
|
49
44
|
end
|
50
45
|
end
|
51
46
|
|
52
47
|
end
|
53
48
|
|
49
|
+
def process_token(token)
|
50
|
+
graph = ::Koala::Facebook::API.new(token)
|
51
|
+
me = graph.get_object('me')
|
52
|
+
RubyApp::Log.debug("FACEBOOK me=#{me.inspect}")
|
53
|
+
RubyApp::Session.identity = self.create_identity_from_me(me)
|
54
|
+
end
|
55
|
+
|
54
56
|
end
|
55
57
|
|
56
58
|
end
|
data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb
CHANGED
@@ -25,7 +25,6 @@ module RubyApp
|
|
25
25
|
super()
|
26
26
|
|
27
27
|
self.loaded do |element, event|
|
28
|
-
|
29
28
|
unless @client
|
30
29
|
RubyApp::Log.debug("OAUTH scopes=#{scopes.inspect}")
|
31
30
|
RubyApp::Log.debug("OAUTH options=#{options.inspect}")
|
@@ -39,14 +38,17 @@ module RubyApp
|
|
39
38
|
code = RubyApp::Request.query['code']
|
40
39
|
access_token = @client.auth_code.get_token(code, :redirect_uri => RubyApp::Request.url)
|
41
40
|
RubyApp::Log.debug("OAUTH token=#{access_token.token.inspect}")
|
42
|
-
|
43
|
-
|
44
|
-
event.go('/')
|
41
|
+
self.process_access_token(access_token)
|
42
|
+
self.hide(event)
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
48
46
|
end
|
49
47
|
|
48
|
+
def process_access_token(access_token)
|
49
|
+
RubyApp::Session.identity = self.create_identity_from_access_token(access_token)
|
50
|
+
end
|
51
|
+
|
50
52
|
end
|
51
53
|
|
52
54
|
end
|
data/lib/ruby_app/elements/mobile/documents/authentication/open_id/authentication_document.rb
CHANGED
@@ -25,7 +25,6 @@ module RubyApp
|
|
25
25
|
super()
|
26
26
|
|
27
27
|
self.loaded do |element, event|
|
28
|
-
|
29
28
|
unless @consumer
|
30
29
|
@consumer = ::OpenID::Consumer.new(RubyApp::Session.data, nil)
|
31
30
|
request = @consumer.begin(identifier)
|
@@ -38,14 +37,13 @@ module RubyApp
|
|
38
37
|
response = @consumer.complete(RubyApp::Request.query, RubyApp::Request.url)
|
39
38
|
case response.status
|
40
39
|
when ::OpenID::Consumer::SUCCESS
|
41
|
-
|
40
|
+
self.process_response(response)
|
42
41
|
RubyApp::Log.info("SESSION RubyApp::Session.identity.url=#{RubyApp::Session.identity.url.inspect}")
|
43
42
|
when ::OpenID::Consumer::FAILURE
|
44
43
|
RubyApp::Log.error("OPENID #{response.class}")
|
45
44
|
RubyApp::Log.error("OPENID #{response.message.inspect}")
|
46
45
|
end
|
47
|
-
|
48
|
-
event.go('/')
|
46
|
+
self.hide(event)
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
@@ -54,6 +52,10 @@ module RubyApp
|
|
54
52
|
def process_request(request)
|
55
53
|
end
|
56
54
|
|
55
|
+
def process_response(response)
|
56
|
+
RubyApp::Session.identity = self.create_identity_from_response(response)
|
57
|
+
end
|
58
|
+
|
57
59
|
def create_identity_from_response(response)
|
58
60
|
return RubyApp::Session::Identity.new(response.identity_url)
|
59
61
|
end
|
data/lib/ruby_app/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RubyApp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 75
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 38
|
10
|
+
version: 0.6.38
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Frank G. Ficnar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|