restpack-web 0.1.47 → 0.1.48
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/restpack-web/app.rb +1 -0
- data/lib/restpack-web/context.rb +6 -5
- data/lib/restpack-web/version.rb +1 -1
- metadata +1 -1
data/lib/restpack-web/app.rb
CHANGED
data/lib/restpack-web/context.rb
CHANGED
@@ -3,7 +3,7 @@ require 'public_suffix'
|
|
3
3
|
module RestPack
|
4
4
|
module Web
|
5
5
|
class Context
|
6
|
-
attr_accessor :domain, :application, :channel, :configurations, :user, :user_id, :request
|
6
|
+
attr_accessor :domain, :application, :channel, :configurations, :services, :user, :user_id, :request
|
7
7
|
|
8
8
|
def initialize(env)
|
9
9
|
restpack = env[:restpack]
|
@@ -14,6 +14,7 @@ module RestPack
|
|
14
14
|
@application = restpack[:application]
|
15
15
|
@channel = restpack[:channel]
|
16
16
|
@configurations = restpack[:configurations]
|
17
|
+
@services = restpack[:services]
|
17
18
|
@user = restpack[:user]
|
18
19
|
@user_id = @user[:id] if @user
|
19
20
|
end
|
@@ -31,6 +32,10 @@ module RestPack
|
|
31
32
|
@application.auth_domain || "auth.#{root_domain}"
|
32
33
|
end
|
33
34
|
|
35
|
+
def root_domain
|
36
|
+
PublicSuffix.parse(@domain.host).domain
|
37
|
+
end
|
38
|
+
|
34
39
|
def logout_url(next_url = nil) #TODO: GJ: whitelist the next_url
|
35
40
|
next_url ||= "http://#{home_domain}/"
|
36
41
|
"http://#{auth_domain}/auth/logout?next=#{next_url}"
|
@@ -40,10 +45,6 @@ module RestPack
|
|
40
45
|
next_url ||= "http://#{home_domain}/"
|
41
46
|
"http://#{auth_domain}/auth/#{provider}?next=#{next_url}"
|
42
47
|
end
|
43
|
-
|
44
|
-
def root_domain
|
45
|
-
PublicSuffix.parse(@domain.host).domain
|
46
|
-
end
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
data/lib/restpack-web/version.rb
CHANGED