module TokenAuthenticateMe::Concerns::Controllers::TokenAuthenticateable

Protected Instance Methods

authenticate_with_header() click to toggle source
# File lib/token_authenticate_me/concerns/controllers/token_authenticateable.rb, line 20
def authenticate_with_header
  header_authentication = TokenAuthenticateMe::HeaderAuthentication.new(controller: self)
  header_authentication.authenticate
end
authenticate_with_params() click to toggle source
# File lib/token_authenticate_me/concerns/controllers/token_authenticateable.rb, line 25
def authenticate_with_params
  header_authentication = TokenAuthenticateMe::ParamAuthentication.new(controller: self)
  header_authentication.authenticate
end
authenticated_session() click to toggle source
# File lib/token_authenticate_me/concerns/controllers/token_authenticateable.rb, line 16
def authenticated_session
  @session ||= (authenticate_with_header || authenticate_with_params)
end
render_unauthorized() click to toggle source
# File lib/token_authenticate_me/concerns/controllers/token_authenticateable.rb, line 30
def render_unauthorized
  headers['WWW-Authenticate'] = 'Token realm="Application"'
  render json: 'Bad credentials', status: 401
end