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 authorization token to file system api #2218

Merged
merged 2 commits into from
Dec 29, 2021

Conversation

MartinFournier
Copy link
Contributor

Disabled http server by default on game start.
Added a new menu item to start or stop the http server.
Added a menu item to enable or disable automatic http server start on game launch.
Now requires a bearer token in the headers of the requests.
The token is generated on first launch and stored in local game files (%APPDATA%/bitburner/config.json on Windows).
Added a menu item to copy the token to the clipboard.

bitburner_kCd8TWrSGt

The extension will have to add a setting to store this token on their side and add it to the request header

curl --location --request POST 'localhost:9990' \
--header 'Authorization: Bearer a3rNN0lhTaSE/QIRxFqTAs6NWSUaZJwuOqIiahWRo5800u4U6Sx14b33yPCNZbNq' \
--header 'Content-Type: application/json' \
--data-raw '{
    "filename": "abc",
    "code": "bla"
}'

Gracefully handle http-server start error & cleanup logs
hexnaught added a commit to hexnaught/vscode-bitburner-connector that referenced this pull request Dec 29, 2021
Changes to the extension to support setting a required 'auth token' genearated by the game, needed by us in order to push files to the games HTTP server.

- New command: 'Add Auth Token'
- New config/setting contribution: 'bitburner.authToken'
- Extension shows error when files are attempted to be pushed, or the filewatcher is attempted to be started when no auth token is set.
- Update readme with no auth flow/process and how-to

See: danielyxie/bitburner#2218
@hexnaught
Copy link
Contributor

As per linked PR. Changes in the extension to support this, if this type of auth is to be used.

hexnaught/vscode-bitburner-connector#4

Branch README with more information. The PR description should cover it though.

@hydroflame hydroflame merged commit b578e09 into danielyxie:dev Dec 29, 2021
hexnaught added a commit to hexnaught/vscode-bitburner-connector that referenced this pull request Dec 30, 2021
* feat(auth): Add requirement for auth token

Changes to the extension to support setting a required 'auth token' genearated by the game, needed by us in order to push files to the games HTTP server.

- New command: 'Add Auth Token'
- New config/setting contribution: 'bitburner.authToken'
- Extension shows error when files are attempted to be pushed, or the filewatcher is attempted to be started when no auth token is set.
- Update readme with no auth flow/process and how-to

See: danielyxie/bitburner#2218

* docs(README): update table of extension config options
github-actions bot pushed a commit to hexnaught/vscode-bitburner-connector that referenced this pull request Dec 30, 2021
# [1.3.0-develop.1](v1.2.1-develop.1...v1.3.0-develop.1) (2021-12-30)

### Features

* **auth:** Add requirement for auth token ([#4](#4)) ([b2d40a1](b2d40a1)), closes [danielyxie/bitburner#2218](danielyxie/bitburner#2218)
github-actions bot pushed a commit to hexnaught/vscode-bitburner-connector that referenced this pull request Dec 30, 2021
# [1.3.0](v1.2.1...v1.3.0) (2021-12-30)

### Features

* **auth:** Add requirement for auth token ([#4](#4)) ([b2d40a1](b2d40a1)), closes [danielyxie/bitburner#2218](danielyxie/bitburner#2218)
@MartinFournier MartinFournier deleted the feature/http-server-auth branch January 3, 2022 14:33
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

Successfully merging this pull request may close these issues.

3 participants