Skip to content

Latest commit

 

History

History

spring-lnurl-auth-example-application

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

🗲 lnurl-auth-example-application

A lnurl-auth example application.

  • uses spring-lnurl-auth-security with default login page
  • uses jMolecules for DDD
  • uses sqlite database for persistence
  • uses in-memory k1 cache (reboots invalidate previous login challenges)
  • automatically registers an .onion url

Screenshot

Run

In order for lnurl-auth to work you must either serve your app over https (no self-signed cert allowed) or as Onion Service. Currently, there is only Simple Bitcoin Wallet that natively supports onion addresses (last checked 2021-07-27). Other wallets will probably support it in the near future. Alternatively, you can use lnpass during development for testing or demonstrating the Lightning Login process.

Onion Service

Start the application with

./gradlew -p incubator/spring-lnurl/spring-lnurl-auth-example-application bootRun --args="--spring.profiles.active=development"

Example console output:

2021-07-27 13:33:13.626  INFO 1221814 --- [  restartedMain] o.t.l.l.e.LnurlAuthExampleApplication    : Starting LnurlAuthExampleApplication using Java 21.0.1
2021-07-27 13:33:17.724  INFO 1221814 --- [  restartedMain] org.berndpruenster.netlayer.tor.Tor      : Starting Tor
2021-07-27 13:33:21.382  INFO 1221814 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-07-27 13:33:21.524  INFO 1221814 --- [  restartedMain] o.t.l.l.e.LnurlAuthExampleApplication    : Started LnurlAuthExampleApplication in 8.305 seconds (JVM running for 8.974)
2021-07-27 13:33:21.562  INFO 1221814 --- [  restartedMain] .l.l.e.LnurlAuthExampleApplicationConfig : =================================================
2021-07-27 13:33:21.572  INFO 1221814 --- [  restartedMain] .l.l.e.LnurlAuthExampleApplicationConfig : ===== TOR IS ENABLED ============================
2021-07-27 13:33:21.573  INFO 1221814 --- [  restartedMain] .l.l.e.LnurlAuthExampleApplicationConfig : onion login: http://abcdef0123456789abcdef0123456789abcdef0123456789abcdef42.onion/login
2021-07-27 13:33:21.573  INFO 1221814 --- [  restartedMain] .l.l.e.LnurlAuthExampleApplicationConfig : =================================================

Then visit the onion url in your Tor browser and log in with lnpass.

Clearnet

If you do not use Onion Services, serving your app with https during development can be done with ngrok:

./ngrok http 8080
# Forwarding  https://abcdef012345.ngrok.io -> http://localhost:8080 

Make sure to adapt the application configuration accordingly:

app:
  # use your own url here (e.g. https://myapp.ngrok.io)
  lnurl-auth-base-url: https://abcdef012345.ngrok.io

...or start the app with argument app.lnurl-auth-base-url:

Start the application with

./gradlew -p incubator/spring-lnurl/spring-lnurl-auth-example-application bootRun --args="--spring.profiles.active=development --app.lnurl-auth-base-url=https://abcdef012345.ngrok.io"

Resources