118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/zaikio/jwt_auth.rb', line 118
def authenticate_by_jwt
token_data = Zaikio::JWTAuth.(request.["Authorization"], **jwt_options)
return render_error("no_jwt_passed", status: :unauthorized) unless token_data
return if show_error_if_token_is_revoked(token_data)
return if show_error_if_authorize_by_jwt_subject_type_fails(token_data)
return if show_error_if_authorize_by_jwt_scopes_fails(token_data)
send(:after_jwt_auth, token_data) if respond_to?(:after_jwt_auth, true)
rescue JWT::ExpiredSignature
render_error("jwt_expired") && (return)
rescue JWT::DecodeError
render_error("invalid_jwt") && (return)
end
|