module Aadhar::Authenticate

Public Instance Methods

authenticate() click to toggle source
# File lib/aadhar/authenticate.rb, line 5
def authenticate
        render :status => 401, :json => { :success => false, :info => "Unauthorized"} if !current_user.present?
end
current_user() click to toggle source
# File lib/aadhar/authenticate.rb, line 9
def current_user
    @current_user ||= begin
      authentication = AuthenticationToken.where(token: params[:auth_token]).first
      authentication.present? ? authentication.user : nil
    end
end