Booked Scheduler Community Support
February 26, 2020, 07:54:50 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: API auth errors workaround  (Read 1077 times)
ppraaron
Newbie
*

Karma: 0
Posts: 2


« on: November 02, 2018, 01:50:29 PM »

I was struggling with using the API in our environment (Debian 9 with Nginx) so I don't know if this is an issue for any other users.

We're using CAS for general authentication and found that the API was trying to use the CAS method for authentication as well. I made a copy of the LoadAuthentication function in the /lib/Common/PluginManager.php file and called it LoadAPIAuthentication.

Line 81 ++
Code:
       /**
         * Loads the default Authentication class
         *
         * @return IAuthentication the authorization class to use
         */
        public function LoadAPIAuthentication()
        {
                require_once(ROOT_DIR . 'lib/Application/Authentication/namespace.php');
                require_once(ROOT_DIR . 'Domain/Access/namespace.php');
                $authentication = new Authentication($this->LoadAuthorization(), new UserRepository());
                $plugin = $this->LoadPlugin(ConfigKeys::PLUGIN_AUTHENTICATION, '',  $authentication);
                if (!is_null($plugin))
                {
                        return $plugin;
                }
                return $authentication;
        }

After adding the code I updated the /Web/Services/index.php file to load the new APIAuthentication function.

Line 101 Change:
Code:
$webService = new AuthenticationWebService($server, new WebServiceAuthentication(PluginManager::Instance()->LoadAuthentication(), new UserSessionRepository()));

to

$webService = new AuthenticationWebService($server, new WebServiceAuthentication(PluginManager::Instance()->LoadAPIAuthentication(), new UserSessionRepository()));

So far this appears to work and provides necessary access.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!