Skip to content

feat(auth): implement plaintext, hashed, and api key authentication methods#69

Open
MattiaPun wants to merge 3 commits intomainfrom
feat/auth-rework
Open

feat(auth): implement plaintext, hashed, and api key authentication methods#69
MattiaPun wants to merge 3 commits intomainfrom
feat/auth-rework

Conversation

@MattiaPun
Copy link
Owner

This implements the reworked authentication system. Users now have the option to choose between plaintext, hashed (token + salt), and api_key methods to authenticate.

The configuration file will auto-migrate as usual. This is the new layout of the credentials.toml file:

[server]
url = ""
username = ""
auth_method = "plaintext" # Options: "plaintext", "hashed", "api_key"

# Required if auth_method = "plaintext"
password = ""

# Required if auth_method = "hashed"
password_hash = ""
password_salt = ""

# Required if auth_method = "api_key"
api_key = ""

Important Notes:

  • Username requirement for API keys: You still have to provide a username when using an API key. Even though it is not strictly needed during API calls, we use the /getUser endpoint on startup and login to validate the credentials, which requires the username.
  • API Key implementation: The api_key method is currently a theoretical implementation. I cannot actually test it against my own backend yet, but it has been built to be strictly conformant with the Subsonic API specification.

Resolves #41

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.

[FEAT] Support for apiKeyAuth as the default behavior, with fallback to plaintext config if unsupported by the server

1 participant