micropub-server-rails 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/micropub/server/rails/middleware.rb +7 -17
- data/lib/micropub/server/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00f8d5e92e1544532202c472d40698702c949908
|
4
|
+
data.tar.gz: 83985b66020fbb74467a53508b71381c9fbce073
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd1fd80e419513f3b7a6c47b6f82c76564afb270945af0061bc71e04627ace990327a4d60fc030e29f19e80f7de04cc9b0fb1d81866c5a5a6e6b6ae23f1c2348
|
7
|
+
data.tar.gz: 58fcadb1e3495fb391a0a9df949a20279fdc1acba0f768989a491ade763b76bd2d0b8b8a327b83805bef248072e953ebd3782b1b8381d18361b0fe9ae6581a94
|
@@ -13,9 +13,9 @@ module Micropub::Server::Rails
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def call(env)
|
16
|
-
@env = env
|
17
16
|
if env["PATH_INFO"] == "/micropub"
|
18
|
-
token = Micropub::Token.new(auth_token)
|
17
|
+
token = Micropub::Token.new(auth_token(env))
|
18
|
+
puts token.inspect
|
19
19
|
if token.valid?
|
20
20
|
response
|
21
21
|
else
|
@@ -26,15 +26,9 @@ module Micropub::Server::Rails
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def env
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
def auth_token
|
34
|
-
@auth_token ||= begin
|
35
|
-
input = env["HTTP_AUTHORIZATION"] || params[:access_token] || ""
|
36
|
-
input.split("Bearer ").last
|
37
|
-
end
|
29
|
+
def auth_token(env)
|
30
|
+
input = env["HTTP_AUTHORIZATION"] || request(env).params[:access_token] || ""
|
31
|
+
input.split("Bearer ").last
|
38
32
|
end
|
39
33
|
|
40
34
|
def response
|
@@ -45,12 +39,8 @@ module Micropub::Server::Rails
|
|
45
39
|
[401, {}, [""]]
|
46
40
|
end
|
47
41
|
|
48
|
-
def request
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
def params
|
53
|
-
request.params
|
42
|
+
def request(env)
|
43
|
+
Rack::Request.new(env)
|
54
44
|
end
|
55
45
|
|
56
46
|
def headers
|