mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
Compare commits
2 Commits
b86481345a
...
cf247ab8dc
| Author | SHA1 | Date | |
|---|---|---|---|
| cf247ab8dc | |||
| ac14f01af2 |
@ -1,7 +1,11 @@
|
|||||||
module Indieauth
|
module Indieauth
|
||||||
class Endpoints
|
class Endpoints
|
||||||
def initialize(site_url)
|
def initialize(site_url)
|
||||||
@endpoints = IndieWeb::Endpoints.get(site_url)
|
@site_url = site_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def endpoints
|
||||||
|
client.endpoints
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(method)
|
def method_missing(method)
|
||||||
@ -10,6 +14,10 @@ module Indieauth
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
attr_accessor :endpoints
|
def client
|
||||||
|
IndieWeb::Endpoints::Client.new(site_url)
|
||||||
|
end
|
||||||
|
|
||||||
|
attr_accessor :site_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -55,7 +55,7 @@ module Micropub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def valid_token?
|
def valid_token?
|
||||||
token = Indieauth::Token.new(endpoints.token_endpoint)
|
token = Indieauth::Token.new(endpoints[:token_endpoint])
|
||||||
|
|
||||||
_, auth_token = request.env["HTTP_AUTHORIZATION"]&.split(" ")
|
_, auth_token = request.env["HTTP_AUTHORIZATION"]&.split(" ")
|
||||||
auth_token ||= params["access_token"]
|
auth_token ||= params["access_token"]
|
||||||
|
|||||||
@ -3,8 +3,7 @@ require "request_helper"
|
|||||||
describe "auth" do
|
describe "auth" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@auth_token = "123abc"
|
@auth_token = "123abc"
|
||||||
endpoints = mock("Indieauth::Endpoints")
|
endpoints = { token_endpoint: "" }
|
||||||
endpoints.stubs(:token_endpoint)
|
|
||||||
Indieauth::Endpoints.stubs(:new).returns endpoints
|
Indieauth::Endpoints.stubs(:new).returns endpoints
|
||||||
Indieauth::Token.any_instance.stubs(:validate).returns(false)
|
Indieauth::Token.any_instance.stubs(:validate).returns(false)
|
||||||
Indieauth::Token.any_instance.stubs(:validate).
|
Indieauth::Token.any_instance.stubs(:validate).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user