Initial commit
This commit is contained in:
14
spec/support/bearer_context.rb
Normal file
14
spec/support/bearer_context.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
shared_context 'bearer authentication' do
|
||||
|
||||
let(:test_user) { create(:user) }
|
||||
|
||||
let(:jwt_token) do
|
||||
pkey = Rails.application.config.x.keystore.private_key
|
||||
codec = Barong::JWT.new(key: pkey)
|
||||
codec.encode(test_user.as_payload)
|
||||
end
|
||||
|
||||
let(:auth_header) { { 'Authorization' => "Bearer #{jwt_token}" } }
|
||||
end
|
||||
Reference in New Issue
Block a user