Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add access token authentication #1

Closed
itviewer opened this issue Feb 21, 2020 · 4 comments
Closed

add access token authentication #1

itviewer opened this issue Feb 21, 2020 · 4 comments

Comments

@itviewer
Copy link

placing an authenticating reverse proxy or using mTLS is annoying
the json-rpc request object has an id member, can we use this parameter to pass the authentication token?
the server:
wg-api --device=<my device> --listen=localhost:1234 --token=abcdef
then the request:
curl http://localhost:8080 -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "GetDeviceInfo", "params": {}, "id":"abcdef"}'
The server performs Token authentication on each request from the client. If it does not match, it just returns an error and without performing any operation.

the argument --token is optional

@jamescun
Copy link
Owner

Hi, @itviewer, thanks for the feedback!

Unfortunetly using the id field for authentication would be a violation of the JSON-RPC 2.0 specification, and I'm not sure how you would configure this with some JSON-RPC clients.

However I am planning on implementing other authentication mechanisms, such as tokens (provided by a HTTP header) and UNIX sockets with permissions. The MVP only ended up having mTLS as this met my initial use case. It shoudln't be long before this is implemented.

I hope this was helpful. 🙂

@itviewer
Copy link
Author

Thanks, it sounds exciting.

@jamescun
Copy link
Owner

Discussing this issue in #2

@jamescun
Copy link
Owner

Fixed by #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants