module UserManagementRails
Constants
- VERSION
Attributes
configuration[RW]
Public Class Methods
configure() { |configuration| ... }
click to toggle source
# File lib/user_management_rails.rb, line 28 def self.configure self.configuration ||= Configuration.new yield(configuration) end
decode_user(jwt)
click to toggle source
# File lib/user_management_rails.rb, line 6 def self.decode_user(jwt) # pub_key = OpenSSL::PKey::RSA.new(ENV['JWT_PUBLIC_KEY']) pub_key = OpenSSL::PKey::RSA.new(self.configuration.jwt_public_key) JWT.decode(jwt, pub_key, true, algorithm: 'RS256')[0] end
valid_jwt?(jwt)
click to toggle source
# File lib/user_management_rails.rb, line 12 def self.valid_jwt?(jwt) # pub_key = OpenSSL::PKey::RSA.new(ENV['JWT_PUBLIC_KEY']) pub_key = OpenSSL::PKey::RSA.new(self.configuration.jwt_public_key) begin JWT.decode(jwt, pub_key, true, algorithm: 'RS256')[0] rescue JWT::DecodeError return false end true end