Class: HubSsoLib::Trust

Inherits:
Object
  • Object
show all
Defined in:
lib/hub_sso_lib.rb

Overview

Class: Trust # # Purpose: Allow other applications to call into the Hub Rails # application to tell it about untrusted user operations. # The application can then store the details, e-mail # moderators and in due course call back to the originating # other application to move the user action forwards. # # The external API is HubSsoLib::Trust::Server, implemented # by the Hub Rails application, not this gem. # # Author: A.D.Hodgkinson # # History: 19-Mar-2025 (ADH): Created #

Defined Under Namespace

Modules: Server

Class Method Summary collapse

Class Method Details

.already_running?Boolean

Is the server already running?

Returns:

  • (Boolean)


923
924
925
926
927
928
# File 'lib/hub_sso_lib.rb', line 923

def self.already_running?
  uri  = self.get_trust_server_connection_uri()
  path = URI.parse(uri).path

  return File.exist?(path)
end

.get_trust_objectObject

Obtain a connection to the trust server. This is called by any client code that needs to talk to the server which must, at the time called, be running via startup within the Hub Rails application.

The returned object is an instance of ::HubSsoLib::Trust::ActionManager, which is defined inside the Hub Rails application. See there for details.



937
938
939
940
941
942
943
944
945
946
947
948
949
# File 'lib/hub_sso_lib.rb', line 937

def self.get_trust_object
  HUB_MUTEX.synchronize do
    begin
      DRb.current_server
    rescue DRb::DRbServerNotFound
      DRb.start_service()
    end

    @@trust_object ||= DRbObject.new_with_uri(self.get_trust_server_connection_uri())
  end

  return @@trust_object
end

.get_trust_server_connection_uriObject

Return the DRb endpoint URI for the trust server.



917
918
919
# File 'lib/hub_sso_lib.rb', line 917

def self.get_trust_server_connection_uri
  HUB_TRUST_CONNECTION_URI
end