/**
  * (non-PHPdoc)
  * @see common_user_auth_Adapter::authenticate()
  */
 public function authenticate()
 {
     $service = new tao_models_classes_oauth_Service();
     try {
         $service->validate($this->request);
         $ltiLaunchData = taoLti_models_classes_LtiLaunchData::fromRequest($this->request);
         return new taoLti_models_classes_LtiUser($ltiLaunchData);
     } catch (common_http_InvalidSignatureException $e) {
         throw new taoLti_models_classes_LtiException('Invalid LTI signature');
     }
 }
 /**
  * Creates a new LTI User with the absolute minimum of required informations
  * 
  * @param taoLti_models_classes_LtiLaunchData $ltiContext
  * @return core_kernel_classes_Resource
  */
 public function spawnUser(taoLti_models_classes_LtiLaunchData $ltiContext)
 {
     $class = new core_kernel_classes_Class(CLASS_LTI_USER);
     //$lang = tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG);
     $props = array(PROPERTY_USER_LTIKEY => $ltiContext->getUserID(), PROPERTY_USER_LTICONSUMER => $this->getLtiConsumerResource($ltiContext));
     if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_FULL)) {
         $props[RDFS_LABEL] = $ltiContext->getUserFullName();
     }
     if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_GIVEN)) {
         $props[PROPERTY_USER_FIRSTNAME] = $ltiContext->getUserGivenName();
     }
     if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_FAMILY)) {
         $props[PROPERTY_USER_LASTNAME] = $ltiContext->getUserFamilyName();
     }
     if ($ltiContext->hasVariable(taoLti_models_classes_LtiLaunchData::LIS_PERSON_CONTACT_EMAIL_PRIMARY)) {
         $props[PROPERTY_USER_MAIL] = $ltiContext->getUserEmail();
     }
     $user = $class->createInstanceWithProperties($props);
     common_Logger::i('added User ' . $user->getLabel());
     return $user;
 }