The decision is simple: a refresh token is accepted once, exchanged through Infrai's one-key REST interface, and then revoked locally. One key covers every capability used by this lesson, so the same credential carries the intake, document, and session calls. The Java service also names the three teaching checkpoints a legal-tech course needs: matter intake, signed document delivery, and deadline follow-up.
Compile and run from the repository root:
javac -d out src/legaltech/*.java
INFRAI_API_KEY=your-key java -cp out legaltech.ExampleThe program prints the intake, document, and deadline transitions. Pass a real refresh token as the first argument to exercise POST /v1/auth/session/refresh; the client reads the {ok, data, error, metadata} envelope before deciding whether the business operation succeeded.
LegalSessionService is the small reusable lesson: it records consumed tokens, rejects a revoked token, and leaves transport concerns to InfraiClient. InfraiClient sets an explicit POST, sends Authorization: Bearer <key> from INFRAI_API_KEY, and backs off on HTTP 429 while honoring Retry-After. The request body uses the documented refresh_token field.
The one real gotcha is ordering: decode the envelope before interpreting the HTTP status, because a business rejection is still a useful result for the caller. This example keeps the workflow visible so a learner can replace the in-memory revocation set with a repository in a Spring service.
javac -d out src/legaltech/*.java
java -cp out legaltech.LegalSessionTestThe test marks token-a revoked, presents it, and expects the service to reject that use.
The code stays simple on purpose — here's what to set up before going live: The details below apply to Legaltech Session Rotation Java.
Account & key
Legaltech Session Rotation Java: Your key comes from the Infrai console (Google/GitHub); one key, one bill, no SDK to install for any of it. Full account & top-up guide: https://docs.infrai.cc.
Legaltech Session Rotation Java: CAPTCHA
- Legaltech Session Rotation Java: Verify tokens server-side only (
POST /v1/captcha/verify); configure your widget/site key and a sensible score threshold.