Module: RazorRisk::Cassini::Applications::RouteVerbAdaptors::Utils
- Includes:
- Pantheios, RazorRisk::Core::Diagnostics::Logger, Razor::Connectivity::Razor3, Razor::Connectivity::Razor3::EntityConnectors, Xqsr3::Quality::ParameterChecking
- Included in:
- Login::AuthOnlyLogin, Login::BasicLogin, Login::JWTLogin, Login::JWTLogout
- Defined in:
- lib/razor_risk/cassini/applications/route_verb_adaptors/utils/open_session.rb,
lib/razor_risk/cassini/applications/route_verb_adaptors/utils/close_session.rb,
lib/razor_risk/cassini/applications/route_verb_adaptors/utils/call_system_status.rb
Instance Method Summary collapse
-
#call_system_status(cr, **options) ⇒ Object
Executes as Razor System Status request.
-
#close_session(session_id, **options) ⇒ Object
Closes a Razor Session.
-
#open_session(cr, **options) ⇒ Object
Opens a Razor session.
Instance Method Details
#call_system_status(cr, **options) ⇒ Object
Executes as Razor System Status request. Will halt the request if the provided credentials are invalid with a 403 status.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/razor_risk/cassini/applications/route_verb_adaptors/utils/call_system_status.rb', line 51 def call_system_status cr, ** trace ParamNames[ :cr, :options ], cr, ssc = SystemStatusConnector.new( [:razor_requester], message_map: [:message_map], credentials: cr ) begin qr = ssc.get indicate_result_by: :qualified_result rescue RazorRequester::InvalidCredentialsException halt 403, {}, 'Invalid credentials' rescue => x log :violation, "unexpected exception (#{x.class}): '#{x.}': #{x.backtrace}" raise end halt 500, {}, 'Oops! Something went wrong!' unless qr.succeeded? end |
#close_session(session_id, **options) ⇒ Object
Closes a Razor Session.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/razor_risk/cassini/applications/route_verb_adaptors/utils/close_session.rb', line 53 def close_session session_id, ** trace ParamNames[ :session_id, :options ], session_id, check_parameter session_id, 'session_id' ec = SessionsConnector.new( [:razor_requester], message_map: [:message_map], credentials: { session_id: session_id } ) begin ec.close_session session_id, indicate_result_by: :qualified_result rescue => x log :violation, "unexpected exception (#{x.class}): '#{x.}': #{x.backtrace}" raise end nil end |
#open_session(cr, **options) ⇒ Object
Opens a Razor session. Will halt the request if the provided credentials are invalid with a 403 status.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/razor_risk/cassini/applications/route_verb_adaptors/utils/open_session.rb', line 51 def open_session cr, ** trace ParamNames[ :cr, :options ], cr, ec = SessionsConnector.new( [:razor_requester], message_map: [:message_map], credentials: cr ) begin qr = ec.open_session indicate_result_by: :qualified_result rescue RazorRequester::InvalidCredentialsException halt 403, {}, 'Invalid credentials' rescue => x log :violation, "unexpected exception (#{x.class}): '#{x.}': #{x.backtrace}" raise end halt 500, {}, 'Oops! Something went wrong!' unless qr.succeeded? begin [ qr.result.at_xpath('@id').value, qr.result.at_xpath('userId').text, qr.result.at_xpath('userProfile/longName').text, ] rescue => x log :critical, "Could not extract user information from new session (#{x.class}): '#{x.}': #{x.backtrace}" halt 500, {}, 'Oops! Something went wrong!' end end |