public interface Ticket extends Serializable
A short, expireable, kickable, verifiable, with some business meaning, instead of meaningless random token. Where `Data` suffix is business semantics, `Part` suffix is transfer semantics, and the layout of different perspectives is. Business layout: SigData + `~` + SigPart - SigData = PubPart + (`~` + BizData)? - PubPart = `mod` + `-` + `due` + `-` + `seq` - BizData: business data, e.g. plaintext Json Transfer layout: PubPart + `~` + SecPart - SecPart = (BizPart + `~`)? + SigPart - BizPart: encrypted BizData - SigPart: Signature data, sign the SigData data. `mod`: convention mode, encryption and signature, BizPart type, etc. for deserialization. English and number `due`: expiration date, number of seconds since 1970-01-01, used to determine time expiration. Positive integers `seq`: serial number, used to determine old or new, business expiration, positive integer `salt`: encryption or signing secret key, such as symmetric secret key, asymmetric private key. When parsing, the easier to understand steps are, (1) Split the Ticket with the 1st `~` into 2 segments: PubData and SecData. (2) Split the 1st segment into 3 parts with 2 `-`: PubMod, PubDue, PubSeq. (3) Split the 2nd segment into 2 parts with 1 `~`: BizPart, SigPart (4) Decrypt BizPart and verify SigData signature with PubMod convention.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Ticket.Mutable |
| Modifier and Type | Field and Description |
|---|---|
static char |
Sep1
default separator of pub
|
static char |
Sep2
default separator of parts
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull String |
getBizPart()
Biz-data part, optional(empty means no biz-data), less than 1k.
|
long |
getPubDue()
Expiration, in seconds from 1970-01-01, not negative
|
@NotNull String |
getPubMod()
The convention schema, including encryption algorithm, signature method,
is a convention of the BizPart structure, supported [az09].
|
int |
getPubSeq()
Serial number, non-negative, incremental and non-consecutive.
|
default @NotNull String |
getSigData()
Get the signature data, i.e.
|
@NotNull String |
getSigPart()
Signature part, usually within 50 characters, to ensure that the Ticket has not been tampered with.
|
default @NotNull String |
serialize()
serialize the Ticket
|
default @NotNull String |
serialize(char sep1,
char sep2)
serialize the Ticket
|
static final char Sep1
static final char Sep2
@NotNull @NotNull String getPubMod()
long getPubDue()
int getPubSeq()
@NotNull @NotNull String getBizPart()
@NotNull @NotNull String getSigPart()
@NotNull default @NotNull String getSigData()
@NotNull default @NotNull String serialize()
@NotNull default @NotNull String serialize(char sep1, char sep2)
Copyright © 2024. All rights reserved.