Class ServerAuthenticator

java.lang.Object
com.iizix.server.push.engine.http.ServerAuthenticator
All Implemented Interfaces:
PushHttpHandler.Authenticator

public final class ServerAuthenticator extends Object implements PushHttpHandler.Authenticator
The authenticator over the server's database users, PUSH-WIRE-CONTRACT.md sections 3.2 and 3.3: Authorization: Basic, decoded as UTF-8 and split at the first colon, checked by UserAuthentication.validatePasswordSignIn(conn,userName,password), which compares the clear-text password against the stored hash and never accepts the hash itself.

One code for every failure. No header that can be used, an unknown user, a wrong password, a disabled account, a held account and a database that cannot answer are all 401 unauthenticated with the same message, so a caller cannot probe which user names exist or which accounts are held; the database failure is also logged SEVERE.

The protections of the server's sign-in (order 638, CC-FIX-PUSH-API-SIGNIN; until it this sign-in checked the password and the disabled flag only, and any account's password could be guessed here without limit). A database account is checked as the interactive sign-in checks it, on the same counters: a wrong password counts a failed sign-in, an account inside the back-off's wait or held after too many failures (AccountHold) is refused without its password being looked at - the server log says why, the reply does not - and the right password clears the failures. The per-source throttle of the interactive sign-in (SourceThrottle, the server's one instance) counts every refused credential, a database user's and a program user's alike, against the client's address, resolved as the session geolocation resolves it: the connection's address, or the address a proxy named in $geo.trustedProxies forwarded; an IPv6 client is counted by its /64. A source that has failed too often is answered 429 with Retry-After before any credential is looked at, whatever the user (PushError.tooManyAttempts(long)). A program user is no database account and is never held; the throttle is its only limit. No second factor is asked for: a machine caller cannot answer one (ruled 2026-11-12).

The sources, in order (section 3.2): the credentials file and the users registered from Java, held by PushCredentials - a user found there is authenticated there and nowhere else, so a wrong password is 401 and never a fall-through - then the database users.

Privileges (section 4.3) are the union of what the user's enabled database groups grant: under the [groups] of the credentials file when one is in force, which replaces the built-in definitions of PUSH-CREDENTIALS.md section 6 entirely, else under those built-ins (PushPrivilege.builtIn(String, boolean)).

The development fallback (section 3.3, Ruling 5): a request with no Authorization acts as the database user "iiziRun Developer" when the server is in development mode, the request is NOT secure by the one rule of WSHelper.isSecure - so a port a reverse proxy secures never falls back - and the remote address is the loopback interface. A disabled development account is refused as a request without credentials is (credentials required), the stored reason logged WARNING (the owner's ruling D-1 of 2026-09-27). The fallback user has the privileges of its groups, like any other database user: a disabled group grants nothing, so with every group disabled it is authenticated with no privilege. The first fallback is logged.

Author:
Christopher Mindus
  • Field Details

    • DEVELOPMENT_USER

      public static final String DEVELOPMENT_USER
      The user an unauthenticated development request acts as.
      See Also:
  • Constructor Details

    • ServerAuthenticator

      public ServerAuthenticator(PushCredentials credentials)
      Constructor: the run mode and WSHelper.isSecure decide, the throttle is the server's (UserAuthentication.getSourceThrottle()) and the trusted proxies are the server setting's.
      Parameters:
      credentials - The credentials file and the users registered from Java.
  • Method Details