Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Make Knock more extensible #192

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/knock/auth_token_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
render json: auth_token, status: :created
end

private
protected
def authenticate
unless entity.present? && entity.authenticate(auth_params[:password])
raise Knock.not_found_exception_class
Expand Down
6 changes: 5 additions & 1 deletion app/model/knock/auth_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ def entity_for entity_class
entity_class.find @payload['sub']
end
end

def as_json
{ jwt: @token }
end

def to_json options = {}
{jwt: @token}.to_json
as_json.to_json
end

private
Expand Down