Class: Db2Session::SessionsController
Instance Method Summary
collapse
Methods included from Manager
#authenticate!, #create_new_connection, #db2_config, #flush_idling_connections!
Instance Method Details
#delete ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'app/controllers/db2_session/sessions_controller.rb', line 16
def delete
request_key.tap do |key|
connection = sessions.fetch(key)
connection.disconnect!
sessions.delete_pair(key, connection)
end
render json: { message: "You are logged out." }, status: :ok
end
|
#new ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/controllers/db2_session/sessions_controller.rb', line 8
def new
connection = create_new_connection
response.("Authorization", "Bearer #{token(connection.object_id)}")
render json: { message: "#{params[:userid]} are logged in." }
rescue Db2Query::ConnectionError => e
render json: { message: e.message }, status: :unauthorized
end
|