Wilmer Paulino 95c405b0c7 auth+proxy: extend Authenticator methods with target service name
The target service name remains unused in its current form, but will be
required in order to verify that an incoming request with an LSAT
attached is authorized to access the service being attempted. We can
derive this from the request's host field, but we choose to extend the
methods with the additional parameter in order to prevent parsing the
host field again to determine which service is being accessed.
2019-11-26 11:12:48 -08:00
2019-09-12 16:41:25 -07:00
2019-01-30 14:56:14 -08:00
2019-11-22 17:08:45 -08:00
2019-11-25 17:08:32 -08:00
2019-11-25 17:08:32 -08:00
2019-11-25 17:08:32 -08:00
2019-09-12 16:41:25 -07:00
2019-11-25 17:08:32 -08:00
2019-01-30 14:56:14 -08:00
2019-11-06 13:21:51 +01:00
2019-11-25 17:08:34 -08:00
2019-11-25 17:08:35 -08:00

Lightning Service Authentication Token (LSAT) proxy

Kirin is a HTTP reverse proxy that supports proxying requests for gRPC (HTTP/2) and REST (HTTP/1 and HTTP/2) backends.

Installation

See INSTALL.md.

Demo

There is a demo installation available at test-staging.swap.lightning.today:8081.

Use Case 1: Web GUI

If you visit the demo installation in the browser, you see a simple web GUI. There you can request the current BOS scores for testnet. Notice that you can only request the scores three times per IP addres. After the free requests have been used up, you receive an LSAT token/macaroon and are challenged to pay an invoice to authorize it.

You have two options to pay for the invoice:

  1. If you have Joule installed in your browser and connected to a testnet node, you can click the "Pay invoice with Joule" button to pay the invoice. After successful payment the page should automatically refresh.
  2. In case you want to pay the invoice manually, copy the payment request to your wallet of choice that has the feature to reveal the preimage after a successful payment. Copy the payment preimage in hex format, then click the button "Paste preimage of manual payment" and paste it in the dialog box.

Use Case 2: cURL

First, let's request the BOS scores until we hit the freebie limit:

curl -k -v https://test-staging.swap.lightning.today:8081/availability/v1/btc.json

At some point, we will get an answer 402 with an authorization header:

www-authenticate: LSAT macaroon='...' invoice='lntb10n1...'

We will need both these values, the macaroon and the invoice so copy them to a text file somewhere (without the single quotes!). Let's pay the invoice now, choose any LN wallet that displays the preimage after a successful payment. Copy the hex encoded preimage to the text file too once you get it from the wallet.

Finally, you can issue the authenticated request with the following command:

curl -k -v \
--header "Authorization: LSAT <macaroon>:<preimage>" \
https://test-staging.swap.lightning.today:8081/availability/v1/btc.json
Description
No description provided
Readme MIT 2.7 MiB
Languages
Go 96.4%
Makefile 1.3%
Shell 0.9%
HTML 0.8%
Dockerfile 0.6%