XMF Cookbook
  • Introduction
  • XMF Cookbook
  • Basic Ingredients
    • Namespaces
    • Autoloading
    • Debugging
    • Forward Compatibility
  • Recipes
    • Introducing Module Helpers
    • Using the Permission Helper
      • Checking Permissions
      • Managing Item Permissions
    • Using the Session Helper
    • Using JSON Web Tokens
    • Altering Database Tables
    • Migrating a Module's Database
    • Loading Initial Data
    • Module Admin Pages
      • Hide and Seek with Icons
      • Standard Admin Pages
    • Manage Metadata
    • Highlighting Content
  • Reference
    • Assert
      • Assertions
    • Database
      • Migrate
      • TableLoad
      • Tables
        • Getting Started
        • Table Operations
        • Working with Columns
        • Working with Indexes
        • Changing Table Data
        • Interacting with the Work Queue
        • Error Info and Debugging
    • Debug
    • FilterInput
    • Highlighter
    • IPAddress
    • Jwt
      • JsonWebToken
      • KeyFactory
      • TokenFactory
      • TokenReader
    • Key
      • ArrayStorage
      • Basic
      • FileStorage
      • KeyAbstract
      • StorageInterface
    • Language
    • Metagen
      • Extracting Data
      • Applying Data
    • Module
      • Admin
      • Helper
      • Helper
        • AbstractHelper
        • Cache
        • GenericHelper
        • Permission
        • Session
    • ProxyCheck
    • Random
    • Request
    • StopWords
    • Uuid
    • Yaml
  • Credits
  • License:
  • Table of Content
Powered by GitBook
On this page
  • TokenReader::fromString($key, $token, $assertClaims)
  • TokenReader::fromCookie($key, $cookieName, $assertClaims)
  • TokenReader::fromRequest($key, $attributeName, $assertClaims)
  • TokenReader::fromHeader($key, $assertClaims, $headerName)
  1. Reference
  2. Jwt

TokenReader

PreviousTokenFactoryNextKey

Last updated 7 years ago

The Xmf\Jwt\TokenReader class provides convenience methods to simplify reading JSON Web Tokens.

TokenReader::fromString($key, $token, $assertClaims)

Validate and decode a JSON Web Token string

The $key is the key that was used to to sign the token. It may be specified as a object, or a key name string that will be used to build a key object using the using a default instance for storage.

The $token is the string to decode and validate.

The $assertClaims array specifies application specific public or claims that are verified while decoding.

Returns the token payload as stdClass, or false if token was invalid.

TokenReader::fromCookie($key, $cookieName, $assertClaims)

Extracts a token string from the cookie named by $cookieName, and uses TokenReader::fromString() to process using the specified $key and $assertClaims.

Returns the token payload as stdClass, or false if token was invalid.

TokenReader::fromRequest($key, $attributeName, $assertClaims)

Extracts a token string from the cookie named by $attributeName, and uses TokenReader::fromString() to process using the specified $key and $assertClaims.

Returns the token payload as stdClass, or false if token was invalid.

TokenReader::fromHeader($key, $assertClaims, $headerName)

Extracts a token string from the cookie named by $headerName, and uses TokenReader::fromString() to process using the specified $key and $assertClaims.

The header is expected to be an bearer token in the authorization header. The default for $headerName should not normally need to be changed.

Returns the token payload as stdClass, or false if token was invalid.

KeyAbstract
KeyFactory
FileStorage
JSON Web Token