68 Commits

Author SHA1 Message Date
Evan Goode
c3cb43885f Add PlayerUUIDGeneration option 2025-07-27 11:49:08 -04:00
Evan Goode
4b1d9d420b Defaults for array-of-tables config settings
Due to https://github.com/BurntSushi/toml/issues/169, we can't simply
use IsDefined to check whether a user supplied a config value in an
array of tables, as in:

[[FallbackAPIServers]]
    CacheTTLSeconds = 123

We can work around this by using *T instead of T in the config
file schema. If the TOML key is not set, it will be parsed as nil.
2025-04-06 23:48:36 +00:00
Evan Goode
770ceededb Batch and rate-limit POST /profiles/minecraft to fallback API servers
For https://github.com/unmojang/drasl/issues/112
2025-04-04 21:00:08 -04:00
Evan Goode
5b8188c202 Correct default skin size limit to 64 2025-04-04 20:50:01 -04:00
Evan Goode
99b8540295 Rename AllowCreatingDeletingPlayers to AllowAddingDeletingPlayers 2025-03-30 12:15:00 -04:00
Evan Goode
817bb432c2 Lint 2025-03-29 19:19:31 -04:00
Evan Goode
a5c06f8827 Add AllowCreatingDeletingPlayers 2025-03-29 18:29:56 -04:00
Evan Goode
489e0fc587 Fix deprecation warning printing 2025-03-29 14:08:30 -04:00
Evan Goode
d7ffab2612 Update config examples and test them 2025-03-28 20:53:45 -04:00
Evan Goode
6fe35be090 Punycode IDNs while reading config file
It's safest to work with punycoded IDNs everywhere. Neither
authlib-injector nor Minecraft's `-Dminecraft.api.*.host` arguments play
nice with Unicode IDNs. Related:
https://github.com/yushijinhun/authlib-injector/issues/270
2025-03-24 17:21:09 -04:00
Evan Goode
5c1f6c1cfa
Implement SSO via OIDC (#127)
Resolves https://github.com/unmojang/drasl/issues/39

* Use __Host- cookie prefix instead of setting Domain

See https://stackoverflow.com/a/64735551

* Unlinking OIDC accounts

* AllowPasswordLogin, OIDC docs, cleanup

* YggdrasilError

* Migrate existing password users without login

* API query/create/delete user OIDC identities

* test APICreateOIDCIdentity

* test APIDeleteeOIDCIdentity

* API Create users with OIDC identities

* OIDC: PKCE

* Use YggdrasilError in authlib-injector routes

* OIDC: AllowChoosingPlayerName

* recipes.md: Update for OIDC and deprecated config options

* OIDC: fix APICreateUser without password, validate oidcIdentities

* OIDC: error at complete-registration if no preferred player name

* Proper error pages

* MC_ prefix for Minecraft Tokens
2025-03-22 16:40:26 -04:00
хлифи
fbc8f9d45a
APIs for login and register (#136)
* APIs for login and register

* return 403 instead of 423 if account is locked

* add login API route to ratelimiter

* APILogin remove browser token gen & return, give API token instead

* generalize login logic

* remove transient user handling

* remove APIRegisterChallenge due to unnecessary

* remove honeypot from APIRegister

* APIRegister remove browser token gen & return, give API token instead

* add register API route to ratelimiter

* add missing API godoc

* Clean up app.Login error handling

* Fix rate-limit errors for API routes

* Deduplicate APICreateUser and APIRegister

* Rate-limit all non-admin unsafe API requests

* APILogin test

* Make SetIsLocked write to the tx

* Add CORSAllowOrigins option

* Assert SetIsLocked without err variable

* Fix and test API rate limiting

---------

Co-authored-by: Evan Goode <mail@evangoo.de>
2025-02-15 21:43:02 -05:00
хлифи
c16361c6bc
Add disabling frontend (#137)
* Add disabling frontend

* fixes requested in review

* Document EnableWebFrontEnd in configuration.md
2025-02-02 22:16:32 -05:00
Evan Goode
25c0404514 config: allow unlimited max player count (-1) 2025-01-19 22:55:37 -05:00
Evan Goode
32840a628e Set default data, state, config paths via env vars
Resolves https://github.com/unmojang/drasl/issues/119.

May be useful for some containerized deployments.
2024-12-28 23:23:13 -05:00
Evan Goode
5a58d24156 Automatic pre-migration DB backups 2024-12-28 21:07:32 -05:00
Evan Goode
738d80538f Make multiple profiles usable from web front end 2024-12-28 21:07:32 -05:00
Evan Goode
1b6fdf2341 Add AllowTextureFromURL option, default false
Adds the `AllowTextureFromURL` config option and makes it false by
default. Admins can still set skins and capes by URL, via the front end
or the API, regardless of this setting. Allowing users to specify
textures via URL is a possible security concern and doesn't really
improve the UX that much, so we should make it opt-in.

For https://github.com/unmojang/drasl/issues/116.
2024-11-26 14:56:59 -05:00
Evan Goode
9ff90d3df9 Bump to 2.0.0 2024-08-15 12:33:59 -04:00
Evan Goode
140ec8bd2e Don't host swag docs 2024-08-15 12:33:59 -04:00
Evan Goode
c70e266d57 Start implementing Drasl API 2024-08-15 12:33:59 -04:00
cat
3441839905 Add ApplicationName, use generic URLs in web UI 2024-08-15 12:33:59 -04:00
cat
2adf099190 Add EnableFooter 2024-07-08 23:52:22 -04:00
Evan Goode
d017879daa Add ValidPlayerNameRegex option
By default, Drasl should check to make sure player names don't contain
special characters.

For https://github.com/unmojang/drasl/issues/73
2024-05-23 16:57:38 -04:00
Evan Goode
e8537ea54c OfflineSkins, also fix several skin issues 2023-11-10 20:19:07 -05:00
Evan Goode
240bfd353f DenyUnknownUsers 2023-11-10 00:02:51 -05:00
Evan Goode
32242f1002 Make fallback API cache configurable
Closes https://github.com/unmojang/drasl/issues/19
2023-09-16 14:00:30 -04:00
Evan Goode
5908508fdd Fix 404s for web ui 2023-09-06 23:07:30 -04:00
Evan Goode
3dbc20a6a9 Add example-config.toml 2023-09-04 16:53:51 -04:00
Evan Goode
15559209ca Create config, state directories if they don't exist
We might want to gate this behind a flag in build_config.go, the Docker
build will want this but maybe not other distributions.
2023-09-03 17:51:20 -04:00
Evan Goode
50a0b95121 Dockerfile, template config file 2023-09-02 19:12:28 -04:00
Evan Goode
d750dacdbb Config validation/cleaning, cleanup 2023-08-29 00:26:21 -04:00
Evan Goode
c5af033ca4 Fix AnonymousLogin, rename to TransientUsers 2023-08-20 02:15:04 +00:00
Evan Goode
3456e33085 Switch from 32-character hex accessTokens to JWTs 2023-08-20 02:15:04 +00:00
Evan Goode
6f621d872e style tweaks, EnableBackgroundEffect 2023-08-04 22:37:04 -04:00
Evan Goode
6405e36db7 Tests for authserver 2023-07-22 18:51:20 -04:00
Evan Goode
fad4a8498c Print initial invite link if necessary 2023-07-09 01:01:26 -04:00
Evan Goode
7665b2129d Add configurable body size limit
Closes #13
2023-07-08 23:30:30 -04:00
Evan Goode
acbd22a011 DefaultAdmins, interface fixes 2023-07-07 20:39:19 -04:00
Evan Goode
9427ab922c Add 'alpha' message to README 2023-07-07 17:24:35 -04:00
Evan Goode
1d49f367f6 Add options to disable skins, capes 2023-07-07 16:52:09 -04:00
Evan Goode
22d5f3525d initial work on invites, admin page 2023-07-06 02:38:03 +00:00
Evan Goode
ee701eac6e Cache certain responses from fallback API servers 2023-06-26 23:58:14 -04:00
Evan Goode
a8bb8832dd s/SkinForwarding/ForwardSkins/, allow setting fallback player 2023-06-25 15:32:24 -04:00
Evan Goode
bbffae71f7 configuration.md 2023-06-25 15:32:24 -04:00
Evan Goode
93127eb9d5 fix tests 2023-06-17 23:57:53 -04:00
Evan Goode
7de5d70a9a rate limiting: enable by default 2023-06-17 23:39:25 -04:00
Evan Goode
cd70c83be0 /publickeys for 1.20 2023-06-16 18:02:26 -04:00
Evan Goode
9eceefbde9 optionally disable token expiry 2023-06-14 00:13:24 -04:00
Evan Goode
ada118546f initial support for authlib-injector 2023-06-03 23:16:42 -04:00