Sha256: 10cf200755c80418bf782b7778b7f226738c5a75acf0baea149a4f02539c1b39

Contents?: true

Size: 395 Bytes

Versions: 2

Compression:

Stored size: 395 Bytes

Contents

class ApplicationController < ActionController::Base
  private

  def authenticate_user!
    if user_signed_in?
      visa_request.touch
    else
      render text: 'Unauthorised', status: 401
    end
  end

  def current_user
    visa_request.tokenable
  end

  def visa_request
    @visa_request ||= Visa::Request.new request.env
  end

  def user_signed_in?
    visa_request.valid?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
visa-0.0.2 spec/internal/app/controllers/application_controller.rb
visa-0.0.1 spec/internal/app/controllers/application_controller.rb