Module: EasyTokens::Authorization
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/easy_tokens/authorization.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#token_invalid ⇒ Object
26 27 28 |
# File 'lib/easy_tokens/authorization.rb', line 26 def token_invalid render text: 'Token is invalid', status: :forbidden end |
#token_required ⇒ Object
22 23 24 |
# File 'lib/easy_tokens/authorization.rb', line 22 def token_required render text: 'Token required', status: :bad_request end |
#validate_token ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/easy_tokens/authorization.rb', line 13 def validate_token if params[:token].present? return if TokenValidator.valid?(params[:token]) token_invalid and return else token_required end end |