Commit 70a31e9ffb11e3b9a2cd777fcfa48238b6b78398

Authored by Paul Barrett
1 parent 20e542bf

Authentication module for atompub included in CMIS atompub

Committed by: Paul Barrett

Reviewed by: Jarrett Jordaan
webservice/atompub/cmis/KT_cmis_atom_service_helper.inc.php
... ... @@ -386,49 +386,6 @@ class KT_cmis_atom_service_helper {
386 386 }
387 387  
388 388 /**
389   - * Log in to KT easily
390   - *
391   - * @param string $username
392   - * @param string $password
393   - * @param string $ip
394   - * @return object Containing the status_code of the login and session id
395   - */
396   - static public function login($username, $password, $ip=null){
397   - $kt = self::getKt();
398   -
399   - $session = $kt->start_session($username,$password, $ip);
400   - if (PEAR::isError($session)){
401   - $response['status_code']=KT_atom_server_FAILURE;
402   - $response['session_id']='';
403   - }else{
404   - $session= $session->get_session();
405   - $response['status_code'] = KT_atom_server_SUCCESS;
406   - $response['session_id'] = $session;
407   - }
408   - return $response;
409   - }
410   -
411   -
412   - /**
413   - * Log out of KT using the session id
414   - *
415   - * @param string $session_id
416   - * @return object Containing the status_code of the logout attempt
417   - */
418   - static public function logout($session_id){
419   - $kt = self::getKt();
420   - $session = $kt->get_active_session($session_id, null);
421   -
422   - if (PEAR::isError($session)){
423   - $response['status_code']=KT_atom_server_FAILURE;
424   - }else{
425   - $session->logout();
426   - $response['status_code'] = KT_atom_server_SUCCESS;
427   - }
428   - return $response;
429   - }
430   -
431   - /**
432 389 * Get the KT singleton instance
433 390 *
434 391 * @return object
... ...
webservice/atompub/cmis/index.php
... ... @@ -46,7 +46,6 @@ define('KT_APP_BASE_URI', "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_
46 46 define('KT_APP_SYSTEM_URI', "http://".$_SERVER['HTTP_HOST']);
47 47 define('KT_ATOM_LIB_FOLDER', '../../classes/atompub/');
48 48  
49   -// should make the "dms" part dynamic but right now this is needed fast
50 49 define('CMIS_APP_BASE_URI', trim(KT_APP_BASE_URI, '/'));
51 50 define('CMIS_APP_SYSTEM_URI', KT_APP_SYSTEM_URI);
52 51 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
64 63  
65 64 include_once('KT_cmis_atom_server.services.inc.php');
66 65  
67   -KT_cmis_atom_service_helper::login('admin', 'admin');
  66 +/**
  67 + * Check Realm Authentication
  68 + */
  69 +require_once(KT_ATOM_LIB_FOLDER.'KT_atom_HTTPauth.inc.php');
  70 +
  71 +if(!KT_atom_HTTPauth::isLoggedIn()) {
  72 + KT_atom_HTTPauth::login('KnowledgeTree DMS', 'You must authenticate to enter this realm');
  73 +}
  74 +
  75 +//$username = $_SERVER['PHP_AUTH_USER'];
  76 +//$password = $_SERVER['PHP_AUTH_PW'];
  77 +//// fetch user name and password (check auth include for proper method)
  78 +//KT_cmis_atom_service_helper::login($username, $password);
68 79  
69 80 //Start the AtomPubProtocol Routing Engine
70 81 $APP = new KT_cmis_atom_server();
... ...