Module: Henlo
- Defined in:
- lib/henlo.rb,
lib/henlo/version.rb,
lib/henlo/helpers/util.rb,
lib/generators/henlo/install_generator.rb,
lib/generators/henlo/migrations_generator.rb
Overview
Helper methods
Defined Under Namespace
Modules: Authenticable, Generators, Helpers, Identifiable, Refreshable, Revocable
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.generate_henlos(options = {}) ⇒ Object
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.
-
.setup {|_self| ... } ⇒ Object
Default way to setup Henlo.
Class Method Details
.generate_henlos(options = {}) ⇒ Object
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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/henlo.rb', line 17 def self.generate_henlos(={}) claim = || nil refresh_token_and_jti = Refreshable.generate_refreshable() id_token_and_exp = Identifiable.generate_identifiable() 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| ... } ⇒ Object
Default way to setup Henlo. Run ‘rails generate henlo:install` to create a fresh initializer with all configuration values.
40 41 42 |
# File 'lib/henlo.rb', line 40 def self.setup yield self end |