Sha256: cf763abab0b3b5e33da35e65fa08dedb04dd57bca83346ebb9af0d23242d9f28
Contents?: true
Size: 582 Bytes
Versions: 9
Compression:
Stored size: 582 Bytes
Contents
module PushType module ApiAuthenticationMethods extend ActiveSupport::Concern included do before_action :authenticate_user! end protected def authenticate_user! unless current_push_type_user head(:unauthorized) end end def current_push_type_user @current_push_type_user ||= begin Knock::AuthToken.new(token: auth_token).entity_for(PushType::User) rescue nil end end def auth_token params[:token] || request.headers['Authorization'].try(:split).try(:last) end end end
Version data entries
9 entries across 9 versions & 1 rubygems