class Wor::Authentication::TokenManager
Constants
- ENCODING_ALGORITHM
Public Class Methods
new(key)
click to toggle source
# File lib/wor/authentication/token_manager.rb, line 8 def initialize(key) @key = key end
Public Instance Methods
decode(token)
click to toggle source
# File lib/wor/authentication/token_manager.rb, line 16 def decode(token) payload = JWT.decode(token, @key, true, algorithm: ENCODING_ALGORITHM)[0] Wor::Authentication::DecodedToken.new(payload) rescue StandardError raise Wor::Authentication::Exceptions::InvalidAuthorizationToken end
encode(payload)
click to toggle source
# File lib/wor/authentication/token_manager.rb, line 12 def encode(payload) JWT.encode(payload, @key, ENCODING_ALGORITHM) end