1. JWT

What does a JWT look like?

1.1.1. Header

A base64-encoded JSON like:

JWT header

{
    "alg": "HS256",
    "typ": "JWT"
}

1.1.2. Claims

A base64-encoded JSON like:

JWT claims

{
    "exp": 1422990129,
    "sub": "jimi",
    "roles": [
        "ROLE_ADMIN",
        "ROLE_USER"
    ],
    "iat": 1422986529
}

1.1.3. Signature

Depends on the algorithm specified on the header, it can be a digital signature of the base64-encoded header and claims, or an encryption of them.