コード例 #1
0
 public static function createNonce($action)
 {
     $time = owa_coreAPI::getNonceTimeInterval();
     $cu = owa_coreAPI::getCurrentUser();
     $user_id = $cu->getUserData('user_id');
     $full_nonce = $time . $action . $user_id . 'owa_nonce';
     $nonce = substr(owa_coreAPI::saltedHash($full_nonce, 'nonce'), -12, 10);
     return $nonce;
 }
コード例 #2
0
 function generateAuthCredential($user_id, $password, $expiration = '', $scheme = 'auth')
 {
     $frag = substr($password, 8, 4);
     $key = owa_coreAPI::saltedHash($user_id . $frag . $expiration, $scheme);
     $algo = 'sha1';
     if (function_exists('hash')) {
         $algo = 'sha256';
     }
     $hash = owa_lib::hash($algo, $user_id . $expiration, $key);
     $credential = $hash;
     // could add other elements here.
     return $credential;
 }