0byt3m1n1
Path:
/
data
/
applications
/
aps.bak
/
vtiger
/
5.0.4
/
standard
/
scripts
/
[
Home
]
File: SSO.php
<?php /** * this file will have the functions required for single sign-on */ require_once("config.php"); require_once('include/nusoap/nusoap.php'); /** * this function accepts a appinstid and token and returns true or false depending on the valditity of the token * @param string $appInstID * @param string $token * @return true if token is correct; false otherwise */ function ns_verifyToken($appInstID, $token){ $client = new soapclient2('http://nprov.prod.netsol.com/api/services/AdminService','wsdl'); //these values are hard-coded $partnerID = "iqos"; $partnerKey = "f87AdZ0f"; if(isset($token) && trim($token)!= "" && isset($appInstID) && trim($appInstID) != ""){ $req = array("appInstId"=>"$appInstID", "credential"=> array("partnerId"=>$partnerID, "partnerKey"=>$partnerKey), "ssoToken"=>$token); $response = $client->call("validateSSOToken", array("req"=>$req), 'http://impl.admin.nsoa.netsol.com'); if($response == "true"){ return true; }else{ return false; } }else{ return false; } } /** * this function accepts the $token and $appInstID information and returns the user information * @param string $token * @param string $appInstID * @return array user information in the format * array("user_name"=>"admin","user_password"=>"admin") * the user name and password are hard coded for now */ function ns_getUserInfo($token, $appInstID){ $error_invalid_data = "The login data entered by you is invalid"; $error_invalid_arguments = "Invalid arguments for the function"; if(trim($token)!="" && trim($appInstID)!=""){ if(ns_verifyToken($appInstID, $token) === true){ //for now the default user is hard-coded to admin return array("user_name"=>"@@ADMIN_NAME@@", "user_password"=>"@@ADMIN_PASSWORD@@"); }else{ return $error_invalid_data; } }else{ return $error_invalid_arguments; } } /** * */ function ns_login($user, $passwd){ session_start(); $_SESSION['SSO_NAME'] = $user; $_SESSION['SSO_KEY'] = $passwd; $url = "Location: index.php?module=Users&action=Authenticate"; header($url); } ?>