Sha256: 3413850430f460aab08e5f3cd2e5e7d6ea6c3b057638bc2b7bb49e2e0e9dc798
Contents?: true
Size: 485 Bytes
Versions: 15
Compression:
Stored size: 485 Bytes
Contents
class AuthorizeRequest class << self def user(headers) @user ||= User.find(decoded_auth_token(headers)[:id]) if decoded_auth_token(headers) @user || nil end def decoded_auth_token(headers) @decoded_auth_token ||= JsonWebToken.decode(http_auth_header(headers)) if http_auth_header(headers) end def http_auth_header(headers) return headers['Authorization'].split(' ').last if headers['Authorization'].present? nil end end end
Version data entries
15 entries across 15 versions & 1 rubygems