Add Java authclient module (mirrors the Go/Node/Python authclient)
Java 8-compatible (not 11+/records as originally suggested) - verified MegaBasterd's pom.xml compiles this source directly via build-helper-maven-plugin rather than depending on a packaged jar, and is pinned to source/target 1.8, so newer APIs would have broken its real build. Uses HttpURLConnection instead of java.net.http.HttpClient, a plain final class instead of a record. No JSON dependency added (defensive regex parsing of AuthGuard's small fixed response shape) - java-backend has zero runtime dependencies today and this is the only class that would need one otherwise. Also added this package's first pom.xml, README.md, and test directory - none existed before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ac516a7dc8
commit
5bf8ec5cee
6 files changed
+599
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# `com.gabriel20xx.shared:java-backend`
|
||||
|
||||
Shared account-management, TOTP, admin reset-code, and AuthGuard client primitives for Java services:
|
||||
|
||||
- `Roles` - shared account-management roles (`superadmin`/`admin`/`user`) and permission checks;
|
||||
- `Totp` - RFC 6238 TOTP secret generation, provisioning URIs, and verification;
|
||||
- `ResetManager` - a short-lived, one-time admin reset-code primitive printed to the server console;
|
||||
- `AuthClient` - a client for a centralized AuthGuard instance's `GET /api/session/validate`, for services that want one shared identity instead of their own local user table. Mirrors `shared/backend/authclient` (Go) and `shared/packages/node-backend/src/authclient.js` (Node) - keep the three in sync if any of them changes shape. Additive: no project is wired up to use it just because this class exists.
|
||||
|
||||
## How this package is actually consumed
|
||||
|
||||
Unlike its `node-backend`/`python-backend` siblings, this package is not published and installed as a dependency. Its real, already-identified consumer - [MegaBasterd](../../../../Forks/MegaBasterd) - instead adds this package's `src/main/java` as an extra source directory of its *own* Maven build, via the `build-helper-maven-plugin` "add-shared-java-auth" execution in `MegaBasterd/pom.xml`, and compiles these `.java` files straight into its own jar. That pom pins `<maven.compiler.source>`/`<target>` to `1.8`, which is why every class in this package targets Java 8 and none of them (including `AuthClient`) take on a dependency beyond the JDK - both would break that real build.
|
||||
|
||||
This package's own `pom.xml` exists only so it can be built and tested in isolation during development; it plays no part in how MegaBasterd (or any future consumer that adopts the same source-inclusion approach) actually builds.
|
||||
|
||||
## Testing
|
||||
|
||||
Run `mvn test` from this package.
|
||||
Reference in new issue
Block a user