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

feat: basic auth for all api endpoints #22

Merged
merged 4 commits into from
Jun 1, 2024

Conversation

DarkAtra
Copy link
Owner

@DarkAtra DarkAtra commented Jun 1, 2024

Description

Allows users to secure all endpoints on the API port using Basic Auth. See also: DarkAtra/v-rising-discord-bot#105.

Warning

Enabling basic auth will secure all endpoints on the API port, including the default ones from Stunlock and endpoints that other plugins might've added.

How to use it

After installing the bot companion and starting the v rising server once, you should find a file v-rising-discord-bot-companion.cfg in BepInEx\config with the following content:

## Settings file was created by plugin v-rising-discord-bot-companion v0.4.1
## Plugin GUID: v-rising-discord-bot-companion

[Authentication]

## A list of comma separated username:password entries that are allowed to query the HTTP API.
# Setting type: String
# Default value: 
BasicAuthUsers = 

To enable basic auth for all api endpoints (including the default endpoints, such as /metrics) just put the desired username and password after BasicAuthUsers = . For example, the following config would configure a user myuser with 1234 as its password:

## Settings file was created by plugin v-rising-discord-bot-companion v0.4.1
## Plugin GUID: v-rising-discord-bot-companion

[Authentication]

## A list of comma separated username:password entries that are allowed to query the HTTP API.
# Setting type: String
# Default value: 
BasicAuthUsers = myuser:1234

You can also add more than one user like this:

## Settings file was created by plugin v-rising-discord-bot-companion v0.4.1
## Plugin GUID: v-rising-discord-bot-companion

[Authentication]

## A list of comma separated username:password entries that are allowed to query the HTTP API.
# Setting type: String
# Default value: 
BasicAuthUsers = myuser:1234,seconduser:somepassword

@DarkAtra DarkAtra merged commit dc2bbd3 into main Jun 1, 2024
3 checks passed
@DarkAtra DarkAtra deleted the feat/basic-auth-for-api-port branch June 1, 2024 16:14
Copy link

github-actions bot commented Jun 1, 2024

🎉 This PR is included in version 0.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

1 participant