/** * @param OpenIdMessage $message * @return null|SessionAssociationDHStrategy|SessionAssociationUnencryptedStrategy */ public static function buildSessionAssociationStrategy(OpenIdMessage $message) { $association_service = ServiceLocator::getInstance()->getService(OpenIdServiceCatalog::AssociationService); $configuration_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::ServerConfigurationService); $log_service = ServiceLocator::getInstance()->getService(UtilsServiceCatalog::LogService); if (OpenIdDHAssociationSessionRequest::IsOpenIdDHAssociationSessionRequest($message)) { return new SessionAssociationDHStrategy(new OpenIdDHAssociationSessionRequest($message), $association_service, $configuration_service, $log_service); } if (OpenIdAssociationSessionRequest::IsOpenIdAssociationSessionRequest($message)) { return new SessionAssociationUnencryptedStrategy(new OpenIdAssociationSessionRequest($message), $association_service, $configuration_service, $log_service); } return null; }
/** * @return bool * @throws InvalidDHParam * @throws \openid\exceptions\InvalidSessionTypeException * @throws \openid\exceptions\InvalidAssociationTypeException */ public function isValid() { $res = parent::isValid(); if (!$res) { return false; } $dh_modulus = $this->getDHModulus(); $dh_gen = $this->getDHGen(); $dh_consumer_public = $this->getDHConsumerPublic(); if (!empty($dh_modulus) && !empty($dh_gen) && !empty($dh_consumer_public)) { return true; } return true; }
/** * @param OpenIdMessage $message * @return bool */ protected function canHandle(OpenIdMessage $message) { $res = OpenIdAssociationSessionRequest::IsOpenIdAssociationSessionRequest($message); return $res; }