nm-gigya 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gigya/controller_utils.rb +28 -5
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54ddacd5192e1bde544288bd6751384422487ee5
|
4
|
+
data.tar.gz: 0ae9c210941b1765ea64caf22fc22841d5a52eef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25f6b600005ff095766ad5da26af0aa1bc70c164c0de7a62e145a013806c387e46b40a11889a28d84cdc80e1fce41d5e7bd3a25db82cbb734b06e726d44f86d1
|
7
|
+
data.tar.gz: bd13e0a4fd14127c32c57253ec9d8ebc5887e0000f6c44a264f473cef783432e6493ae0d5194004f03495aca4f5a9e627781b3cc6ee4834824eaa63f18e90433
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module Gigya
|
2
2
|
### Helper/controller mixins
|
3
3
|
module ControllerUtils
|
4
|
+
GIGYA_SESSION_PARAM = :gigya_token
|
5
|
+
GIGYA_QUERY_PARAM = :gigya_token
|
6
|
+
GIGYA_COOKIE_PARAM = :gigya_token
|
7
|
+
|
4
8
|
def gigya_user_required
|
5
9
|
begin
|
6
10
|
render(:json => {:error => "Invalid login"}, :status => 401) if gigya_user_identifier.blank?
|
@@ -10,26 +14,45 @@ module Gigya
|
|
10
14
|
end
|
11
15
|
|
12
16
|
def interpret_jwt_token
|
13
|
-
@
|
17
|
+
@gigya_token ||= begin
|
14
18
|
tmp_token = nil
|
15
19
|
authenticate_with_http_token do |token, options|
|
16
20
|
tmp_token = token
|
17
21
|
end
|
18
|
-
tmp_token = params[
|
22
|
+
tmp_token = params[GIGYA_QUERY_PARAM] unless params[GIGYA_QUERY_PARAM].blank?
|
23
|
+
if tmp_token.blank?
|
24
|
+
tmp_token = cookies[GIGYA_COOKIE_PARAM]
|
25
|
+
end
|
26
|
+
|
27
|
+
if tmp_token.blank?
|
28
|
+
tmp_token = session[GIGYA_SESSION_PARAM]
|
29
|
+
end
|
30
|
+
|
19
31
|
tmp_token
|
20
32
|
end
|
21
|
-
@
|
33
|
+
@gigya_jwt_info ||= Gigya::Connection.shared_connection.validate_jwt(@gigya_token)
|
34
|
+
end
|
35
|
+
|
36
|
+
def gigya_save_jwt(destination = :cookie)
|
37
|
+
interpret_jwt_token
|
38
|
+
if destination == :cookie
|
39
|
+
cookies[GIGYA_COOKIE_PARAM] = @gigya_token
|
40
|
+
elsif destination == :session
|
41
|
+
cookies[GIGYA_SESSION_PARAM] = @gigya_token
|
42
|
+
else
|
43
|
+
raise "Invalid Gigya JWT destination"
|
44
|
+
end
|
22
45
|
end
|
23
46
|
|
24
47
|
def gigya_user_information
|
25
48
|
interpret_jwt_token
|
26
|
-
@
|
49
|
+
@gigya_jwt_info
|
27
50
|
end
|
28
51
|
|
29
52
|
def gigya_user_identifier
|
30
53
|
@gigya_user_identifier ||= begin
|
31
54
|
interpret_jwt_token
|
32
|
-
@
|
55
|
+
@gigya_jwt_info["sub"]
|
33
56
|
end
|
34
57
|
end
|
35
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nm-gigya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Bartlett
|
8
|
+
- Tyler Jackson
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: httparty
|
@@ -38,7 +39,7 @@ dependencies:
|
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '2.1'
|
41
|
-
description:
|
42
|
+
description:
|
42
43
|
email: jonathan@newmedio.com
|
43
44
|
executables: []
|
44
45
|
extensions: []
|
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
68
|
version: '0'
|
68
69
|
requirements: []
|
69
70
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.5.2.1
|
71
72
|
signing_key:
|
72
73
|
specification_version: 4
|
73
74
|
summary: Gigya API Utility Package
|