bitshares-core icon indicating copy to clipboard operation
bitshares-core copied to clipboard

Signals for the external acquisition of an api_access_info

Open Dimfred opened this issue 5 years ago • 2 comments

With this PR I would like to introduce two new signals, to enable the api login process through an external_service.

Signal1: application::login_attempt emitted at the end of application_impl::new_connection.

Signature:     
bool& // should be set by the external service to true, if it is active. 
      // It's bool& to avoid return types 
      // cause this would result in returning a boost::optional
string& // username
string& // password
login_api& // the created login_api (needed to connect the second signal)

Signal2: login_api::api_access_info_external emitted at the beginning of login_api::login.

Signature:
string& // username
fc::optional<api_access_info>& // to be filled by the `external_service`

Logic:

signal::login_attempt is emitted
    => if no service connected: default login
        => signal::api_access_info_external emitted
           => does not set the optional 
           => from here default login
    => else: rerouted login through the external_service
       => service connects to login_api::signal::api_access_info_external           
          => singal::api_access_info_external emitted
             => service trys to find api_access_info to given user
                => if found: login with found
                => else default login

   

Alternatively this could be done with the first signal alone, but then the service would have to implement the login logic, which I tried to avoid here.

What do you think? Would this be a way to implement that? Open for any discussion.

Dimfred avatar Nov 13 '19 11:11 Dimfred

I'm not really clear which problem you are trying to solve here. Please open an issue describing the problem first, then we'll discuss how to best solve it.

pmconrad avatar Nov 13 '19 14:11 pmconrad

Oh this was quite a while ago. If I find time I could look at what I even did there and maybe add tests / an example on how it could be used.

Dimfred avatar Aug 08 '22 11:08 Dimfred