models.jwt.storages

Class DBTokenStorage

lucee.Component
    extended by models.jwt.storages.DBTokenStorage

Copyright since 2016 by Ortus Solutions, Corp www.ortussolutions.com --- A Database based token storage. Properties - table : the table to use - schema : the schema to use (if db support it) - dsn : the dsn to use, no dsn, we use the global one - autoCreate : if true, then we will create the table. Defaults to true The columns needed in the table are - id : db identifier - cacheKey : varchar 255 - token : text - expiration : (unix timestamp) - issued : (unix timestamp) - subject : varchar 255

Class Attributes:
  • threadsafe
  •  
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    any cache
          The linked cache provider.

    • access = public
    • returntype = any
    true false
    any cachebox


    • access = public
    • returntype = any
    • inject = cachebox
    true false
    any jwtService


    • access = public
    • returntype = any
    • inject = JwtService@cbSecurity
    true false
    any keyPrefix
          The configured key prefix for the storage.

    • access = public
    • returntype = any
    true false
    any log


    • access = public
    • returntype = any
    • inject = logbox:logger:{this}
    true false
    any properties
          Storage properties.

    • access = public
    • returntype = any
    true false
    any scheduler


    • access = public
    • returntype = any
    • inject = executor:coldbox-tasks
    true false
    any settings


    • access = public
    • returntype = any
    • inject = coldbox:moduleSettings:cbSecurity
    true false
    any wirebox


    • access = public
    • returntype = any
    • inject = wirebox
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    any clear(any key)
         Invalidate/delete one or more keys from the storage.
    any clearAll()
         Clear all the keys in the storage.
    any configure(any properties)
         Configure the storage by passing in the properties.
    any doRotation()
         Do the rotation.
    private any ensureTable()
         Verify or create the logging table.
    boolean exists(any key)
         Verify if the passed in token key exists and is valid.
    struct get(any key, [struct defaultValue])
         Retrieve the token via the cache key, if the key doesn't exist a TokenNotFoundException will be thrown.
    string getCache()
    string getCachebox()
    private any getDateTimeColumnType()
         Get db specific text column type.
    private string getDefaultDatasource()
         Get the default application datasource.
    string getJwtService()
    string getKeyPrefix()
    string getLog()
    string getProperties()
    string getScheduler()
    string getSettings()
    private any getTable()
         Return the table name with the appropriate schema included if found.
    private any getTextColumnType()
         Get db specific text column type.
    string getWirebox()
    array keys()
         Retrieve all the jwt keys stored in the storage.
    any set(any key, any token, any expiration, any payload)
         Set a token in the storage.
    any setCache(any cache)
    any setCachebox(any cachebox)
    any setJwtService(any jwtService)
    any setKeyPrefix(any keyPrefix)
    any setLog(any log)
    any setProperties(any properties)
    any setScheduler(any scheduler)
    any setSettings(any settings)
    any setWirebox(any wirebox)
    numeric size()
         The size of the storage.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Property Detail

    cache

    property any cache

    The linked cache provider

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    cachebox

    property any cachebox

    Attributes:
    access - public
    required - false
    returntype - any
    inject - cachebox
    serializable - true

    jwtService

    property any jwtService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - JwtService@cbSecurity
    serializable - true

    keyPrefix

    property any keyPrefix

    The configured key prefix for the storage

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    log

    property any log

    Attributes:
    access - public
    required - false
    returntype - any
    inject - logbox:logger:{this}
    serializable - true

    properties

    property any properties

    Storage properties

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    scheduler

    property any scheduler

    Attributes:
    access - public
    required - false
    returntype - any
    inject - executor:coldbox-tasks
    serializable - true

    settings

    property any settings

    Attributes:
    access - public
    required - false
    returntype - any
    inject - coldbox:moduleSettings:cbSecurity
    serializable - true

    wirebox

    property any wirebox

    Attributes:
    access - public
    required - false
    returntype - any
    inject - wirebox
    serializable - true

    Method Detail

    clear

    public any clear(any key)

    Invalidate/delete one or more keys from the storage

    Parameters:
    key - A cache key or an array of keys to clear
    Returns:
    JWTStorage

    clearAll

    public any clearAll()

    Clear all the keys in the storage

    Returns:
    JWTStorage

    configure

    public any configure(any properties)

    Configure the storage by passing in the properties

    Parameters:
    properties - The storage properties
    Returns:
    JWTStorage
    Throws:
    PropertyNotDefined - When no table property is defined

    doRotation

    public any doRotation()

    Do the rotation


    ensureTable

    private any ensureTable()

    Verify or create the logging table


    exists

    public boolean exists(any key)

    Verify if the passed in token key exists and is valid.

    Parameters:
    key - The cache key

    get

    public struct get(any key, [struct defaultValue])

    Retrieve the token via the cache key, if the key doesn't exist a TokenNotFoundException will be thrown

    Parameters:
    key - The cache key
    defaultValue - If not found, return a default value
    Throws:
    TokenNotFoundException

    getCache

    public string getCache()


    getCachebox

    public string getCachebox()


    getDateTimeColumnType

    private any getDateTimeColumnType()

    Get db specific text column type


    getDefaultDatasource

    private string getDefaultDatasource()

    Get the default application datasource


    getJwtService

    public string getJwtService()


    getKeyPrefix

    public string getKeyPrefix()


    getLog

    public string getLog()


    getProperties

    public string getProperties()


    getScheduler

    public string getScheduler()


    getSettings

    public string getSettings()


    getTable

    private any getTable()

    Return the table name with the appropriate schema included if found.


    getTextColumnType

    private any getTextColumnType()

    Get db specific text column type


    getWirebox

    public string getWirebox()


    keys

    public array keys()

    Retrieve all the jwt keys stored in the storage


    set

    public any set(any key, any token, any expiration, any payload)

    Set a token in the storage

    Parameters:
    key - The cache key
    token - The token to store
    expiration - The token expiration
    payload - The payload
    Returns:
    JWTStorage

    setCache

    public any setCache(any cache)

    Parameters:
    cache

    setCachebox

    public any setCachebox(any cachebox)

    Parameters:
    cachebox

    setJwtService

    public any setJwtService(any jwtService)

    Parameters:
    jwtService

    setKeyPrefix

    public any setKeyPrefix(any keyPrefix)

    Parameters:
    keyPrefix

    setLog

    public any setLog(any log)

    Parameters:
    log

    setProperties

    public any setProperties(any properties)

    Parameters:
    properties

    setScheduler

    public any setScheduler(any scheduler)

    Parameters:
    scheduler

    setSettings

    public any setSettings(any settings)

    Parameters:
    settings

    setWirebox

    public any setWirebox(any wirebox)

    Parameters:
    wirebox

    size

    public numeric size()

    The size of the storage