module Warden::JWTAuth
JWT authentication plugin for warden.
It consists of a strategy which tries to authenticate an user decoding a token present in the `Authentication` header (as `Bearer %token%`). From it, it takes the `sub` claim and provides it to a configured repository of users for the current scope.
It also consists of two rack middlewares which perform two actions for configured request paths: dispatching a token for a signed in user and revoking an incoming token.
Constants
- Import
- VERSION
Public Class Methods
constantize_values(hash)
click to toggle source
# File lib/warden/jwt_auth.rb, line 35 def constantize_values(hash) hash.each_with_object({}) do |(key, value), memo| memo[key] = value.is_a?(String) ? Object.const_get(value) : value end end
symbolize_keys(hash)
click to toggle source
# File lib/warden/jwt_auth.rb, line 22 def symbolize_keys(hash) hash.each_with_object({}) do |(key, value), memo| memo[key.to_sym] = value end end
upcase_first_items(array)
click to toggle source
# File lib/warden/jwt_auth.rb, line 28 def upcase_first_items(array) array.map do |tuple| method, path = tuple [method.to_s.upcase, path] end end
Private Instance Methods
constantize_values(hash)
click to toggle source
# File lib/warden/jwt_auth.rb, line 35 def constantize_values(hash) hash.each_with_object({}) do |(key, value), memo| memo[key] = value.is_a?(String) ? Object.const_get(value) : value end end
symbolize_keys(hash)
click to toggle source
# File lib/warden/jwt_auth.rb, line 22 def symbolize_keys(hash) hash.each_with_object({}) do |(key, value), memo| memo[key.to_sym] = value end end
upcase_first_items(array)
click to toggle source
# File lib/warden/jwt_auth.rb, line 28 def upcase_first_items(array) array.map do |tuple| method, path = tuple [method.to_s.upcase, path] end end