From 70a31e9ffb11e3b9a2cd777fcfa48238b6b78398 Mon Sep 17 00:00:00 2001 From: Paul Barrett Date: Wed, 15 Jul 2009 17:17:10 +0200 Subject: [PATCH] Authentication module for atompub included in CMIS atompub --- webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php | 43 ------------------------------------------- webservice/atompub/cmis/index.php | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 45 deletions(-) diff --git a/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php b/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php index a47d5ad..64545e7 100644 --- a/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php +++ b/webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php @@ -386,49 +386,6 @@ class KT_cmis_atom_service_helper { } /** - * Log in to KT easily - * - * @param string $username - * @param string $password - * @param string $ip - * @return object Containing the status_code of the login and session id - */ - static public function login($username, $password, $ip=null){ - $kt = self::getKt(); - - $session = $kt->start_session($username,$password, $ip); - if (PEAR::isError($session)){ - $response['status_code']=KT_atom_server_FAILURE; - $response['session_id']=''; - }else{ - $session= $session->get_session(); - $response['status_code'] = KT_atom_server_SUCCESS; - $response['session_id'] = $session; - } - return $response; - } - - - /** - * Log out of KT using the session id - * - * @param string $session_id - * @return object Containing the status_code of the logout attempt - */ - static public function logout($session_id){ - $kt = self::getKt(); - $session = $kt->get_active_session($session_id, null); - - if (PEAR::isError($session)){ - $response['status_code']=KT_atom_server_FAILURE; - }else{ - $session->logout(); - $response['status_code'] = KT_atom_server_SUCCESS; - } - return $response; - } - - /** * Get the KT singleton instance * * @return object diff --git a/webservice/atompub/cmis/index.php b/webservice/atompub/cmis/index.php index 9fea1ed..9584406 100644 --- a/webservice/atompub/cmis/index.php +++ b/webservice/atompub/cmis/index.php @@ -46,7 +46,6 @@ define('KT_APP_BASE_URI', "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_ define('KT_APP_SYSTEM_URI', "http://".$_SERVER['HTTP_HOST']); define('KT_ATOM_LIB_FOLDER', '../../classes/atompub/'); -// should make the "dms" part dynamic but right now this is needed fast define('CMIS_APP_BASE_URI', trim(KT_APP_BASE_URI, '/')); define('CMIS_APP_SYSTEM_URI', KT_APP_SYSTEM_URI); define('CMIS_ATOM_LIB_FOLDER', trim(KT_ATOM_LIB_FOLDER, '/') . '/cmis/'); @@ -64,7 +63,19 @@ include_once(CMIS_ATOM_LIB_FOLDER.'KT_cmis_atom_service.inc.php'); //Co include_once('KT_cmis_atom_server.services.inc.php'); -KT_cmis_atom_service_helper::login('admin', 'admin'); +/** + * Check Realm Authentication + */ +require_once(KT_ATOM_LIB_FOLDER.'KT_atom_HTTPauth.inc.php'); + +if(!KT_atom_HTTPauth::isLoggedIn()) { + KT_atom_HTTPauth::login('KnowledgeTree DMS', 'You must authenticate to enter this realm'); +} + +//$username = $_SERVER['PHP_AUTH_USER']; +//$password = $_SERVER['PHP_AUTH_PW']; +//// fetch user name and password (check auth include for proper method) +//KT_cmis_atom_service_helper::login($username, $password); //Start the AtomPubProtocol Routing Engine $APP = new KT_cmis_atom_server(); -- libgit2 0.21.4