module Henlo

Defines default initializing values and main method for generating tokens

Helper methods

Constants

VERSION

Public Class Methods

generate_henlos(options={}) click to toggle source

Generates refresh and access tokens when method is called, allows the passing in of additional key value pairs to be encoded in the jwt payload Returns the jwt identifier of the refresh token, as well as the expiry time in unix seconds of the id token.

# File lib/henlo.rb, line 17
def self.generate_henlos(options={})
  claim = options || nil 
  refresh_token_and_jti = Refreshable.generate_refreshable(options) 
  id_token_and_exp = Identifiable.generate_identifiable(options)
  tokens = Hash[
    id_token: id_token_and_exp[:token],
    refresh_token: refresh_token_and_jti[:token]
  ]
  henlos = Hash[
    tokens: tokens, 
    jti: refresh_token_and_jti[:jti],
    exp: id_token_and_exp[:exp]
  ]
end
setup() { |self| ... } click to toggle source

Default way to setup Henlo. Run `rails generate henlo:install` to create a fresh initializer with all configuration values.

# File lib/henlo.rb, line 40
def self.setup
  yield self
end