This repository was archived by the owner on Mar 22, 2021. It is now read-only.

Description
In authenticable.rb the @current_user is retrieved like this
@current_user = User.find(payload['user_id'])
but since there is no User model in the lib it will force whoever who uses knock to have a model named User and expect a claim named user_id to be present in the JWT.
What I'd like to have is a way to define how the user is retrieved from my DB, e.g. in my app's config/knock.rb I could have:
config.current_user_from_token = -> (claims) { User.find(claims['sub']) }
and then in authenticable.rb
@current_user = Knock.current_user_from_token.call(payload)
This will allow to fetch the user from any model using any claim in the JWT