[GH-ISSUE #3173] [Feature Request] basic authentication using a simple SQLite database #2543

Closed
opened 2026-05-05 13:38:17 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @shabakett on GitHub (Nov 17, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/3173

add authentication_method = basic, basic_authentication_username and basic_authentication_password
using a local SQLite database with a table "clients" (username, password)

Originally created by @shabakett on GitHub (Nov 17, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/3173 add `authentication_method = basic`, basic_authentication_username and basic_authentication_password using a local SQLite database with a table "clients" (username, password)
Author
Owner

@fatedier commented on GitHub (Nov 18, 2022):

You can implement your own plugin like this fp-multiuser

<!-- gh-comment-id:1319480223 --> @fatedier commented on GitHub (Nov 18, 2022): You can implement your own plugin like this [fp-multiuser](https://github.com/gofrp/fp-multiuser)
Author
Owner

@shabakett commented on GitHub (Nov 21, 2022):

another option is to use fastapi:

@app.post("/tunnel_auth")
async def tunnel_auth(request: Request):
    try:
        body = await request.json()
        results = await database.fetch_all(query="SELECT * FROM tunnel WHERE tun_enabled=1 AND tun_endpoint_code=:code AND tun_password=:password", values={"code": body["content"]["user"], "password": body["content"]["metas"]["password"]}) 
        if results: return {"reject": False, "unchange": True } 
        else: return {"reject": True, "reject_reason": "authentication failed!" }
    except Exception as e:
        return {"reject": True, "reject_reason": "exception: " + str(e) }
<!-- gh-comment-id:1321481383 --> @shabakett commented on GitHub (Nov 21, 2022): another option is to use fastapi: @app.post("/tunnel_auth") async def tunnel_auth(request: Request): try: body = await request.json() results = await database.fetch_all(query="SELECT * FROM tunnel WHERE tun_enabled=1 AND tun_endpoint_code=:code AND tun_password=:password", values={"code": body["content"]["user"], "password": body["content"]["metas"]["password"]}) if results: return {"reject": False, "unchange": True } else: return {"reject": True, "reject_reason": "authentication failed!" } except Exception as e: return {"reject": True, "reject_reason": "exception: " + str(e) }
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#2543
No description provided.