001package gudusoft.gsqlparser.runtime;
002
003/**
004 * Why an entitlement was accepted or rejected.
005 *
006 * <p>These codes are a stable contract: they appear in host logs and support
007 * tickets, so a value is never renamed or repurposed once shipped. New reasons
008 * are added at the end.</p>
009 *
010 * <p>Note the asymmetry that the design requires. The code is written to the
011 * HOST's log together with an audit id so an operator can diagnose a refusal in
012 * seconds. It is NOT what an end user sees: an unauthorised caller gets a
013 * generic runtime error and no output at all, so a refusal never reveals which
014 * check failed and never emits a result anybody could mistake for real
015 * analysis.</p>
016 *
017 * @since 4.2.7
018 */
019public enum GspActivationStatus {
020
021    /** A valid, in-date entitlement for this build was accepted. */
022    ACTIVE,
023
024    /** No entitlement was supplied. */
025    MISSING,
026
027    /** Not a well-formed token — wrong encoding, truncated, not three parts. */
028    MALFORMED,
029
030    /** Well-formed, but the signature does not verify against the embedded public key. */
031    BAD_SIGNATURE,
032
033    /** Signed correctly, but addressed to a different audience than this runtime. */
034    WRONG_AUDIENCE,
035
036    /** Signed correctly, but {@code exp} is in the past. */
037    EXPIRED,
038
039    /** Signed correctly, but {@code nbf} is in the future. */
040    NOT_YET_VALID,
041
042    /** Signed correctly, but not valid for this GSP build. */
043    WRONG_BUILD,
044
045    /** Signed correctly, but does not grant the edition this jar requires. */
046    WRONG_EDITION,
047
048    /** Signed by a key id this build does not know — typically a rotation gap. */
049    UNKNOWN_KEY;
050
051    /** @return true only for {@link #ACTIVE}. */
052    public boolean isValid() {
053        return this == ACTIVE;
054    }
055}