andrewfun 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/andrewfun.rb +34 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a66364fa6ea8fa0e38f3f9b63642e125eb6bfcd9b6525384dafc975d01834d06
|
4
|
+
data.tar.gz: 18c817c7cd0c7ba359bf6c8ac74e7458c3976ddb73d2bbdc55dde50ca21d25f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e74cfa47501a38fbd7de20de662c62e597dd50e7d06a45eb662870ef71dda3166c91112449f46aeb39fd22d9d76a0887445544f6ddf9919a2d6c2e10440bf5f
|
7
|
+
data.tar.gz: bea473da9d2a62ce2fc465b25abb6411b090891e9267371c0cd5bd46e7c4cd993b7e84946dfd91f5d4cc12af954cb55f1445aa9ef7399713a333a4ba83bae953
|
data/lib/andrewfun.rb
CHANGED
@@ -6,6 +6,9 @@ class Andrewfun
|
|
6
6
|
response = HTTParty.get(url)
|
7
7
|
authorizationResponse = JSON.parse(response.body)
|
8
8
|
puts authorizationResponse["authorized"]
|
9
|
+
otp = request.headers["HTTP_OTP"]
|
10
|
+
humantoken = request.headers["HTTP_HUMANTOKEN"]
|
11
|
+
devicetoken = request.headers["HTTP_DEVICE_TOKEN"]
|
9
12
|
ip = request.remote_ip
|
10
13
|
if ip == "::1" || ip == "127.0.0.1"
|
11
14
|
puts "here"
|
@@ -15,9 +18,39 @@ class Andrewfun
|
|
15
18
|
parsedIpData = JSON.parse(realIpData.body)
|
16
19
|
ip = parsedIpData["ip"]
|
17
20
|
end
|
18
|
-
|
21
|
+
possibletoken = request.headers["HTTP_TOKEN"].split("Bearer ")
|
22
|
+
token = request.headers["HTTP_TOKEN"] || possibletoken
|
23
|
+
headers = {
|
24
|
+
"method" => request.method,
|
25
|
+
"ip" => ip,
|
26
|
+
"token" => token,
|
27
|
+
"api" => request.original_url
|
28
|
+
}
|
29
|
+
|
30
|
+
if devicetoken != nil
|
31
|
+
headers["device_token"] = devicetoken
|
32
|
+
end
|
33
|
+
|
34
|
+
if otp != nil
|
35
|
+
headers["otp"] = otp
|
36
|
+
end
|
37
|
+
|
38
|
+
if humantoken != nil
|
39
|
+
headers["humantoken"] = humantoken
|
40
|
+
end
|
41
|
+
|
42
|
+
|
19
43
|
puts token
|
44
|
+
puts devicetoken
|
45
|
+
puts humantoken
|
46
|
+
puts otp
|
20
47
|
puts ip
|
48
|
+
puts headers
|
49
|
+
authorizedMessage = HTTParty.get(url, :headers => headers)
|
50
|
+
authorizationResult = JSON.parse(authorizedMessage.body)
|
51
|
+
if authorizationResult["authorized"] != true
|
52
|
+
render json: authorizationResult, status: 401
|
53
|
+
end
|
21
54
|
end
|
22
55
|
|
23
56
|
|