IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Sécurité Discussion :

authentification avec google


Sujet :

Sécurité

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut authentification avec google
    Bonjour,
    J'ai un projet à réaliser avec la fac qui consiste à rendre accessible google calendar aux non-voyants. Pour cela j'ai utilisé l'API google et zend framework. Débutant dans la programmation internet, je n'ai pas réussi à résoudre mon problème, malgré mes recherches sur les nombreux forums. Mon problème est le suivant, lors de l'authentification, un message d'erreur s'affiche:


    Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Unable to Connect to ssl://www.google.com:443. Error #22: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?' in C:\wamp\www\gapa\Zend\Gdata\AuthSub.php:114 Stack trace: #0 C:\wamp\www\gapa\authentification.php(56): Zend_Gdata_AuthSub::getAuthSubSessionToken('CLDG0OHqBBDbi43...') #1 C:\wamp\www\gapa\authentification.php(70): getAuthSubHttpClient() #2 {main} thrown in C:\wamp\www\gapa\Zend\Gdata\AuthSub.php on line 114

    Je vous remercie par avance quelque soit l'aide que vous pourrez m'apportez.

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    36
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 36
    Points : 40
    Points
    40
    Par défaut
    Et si tu remplaces ssl://www.google.com par https://www.google.com/ ?

  3. #3
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Tout d'abord, merci pour ta réponse rapide. En faite, le code est le suivant et à aucun moment je ne fait de ssl mais en même temps j'ai repris entièrement le code de l'API et je dois avouer que certaines lignes restent un grand mystère...

    <?php
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_AuthSub');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Http_Client');

    /** Retrieve the current URL so that the AuthSub server knows where to * redirect the user after authentication is complete. */
    function getCurrentUrl(){
    global $_SERVER;
    // Filter php_self to avoid a security vulnerability.
    $php_request_uri = htmlentities(substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], "\n\r")), ENT_QUOTES);
    if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')
    {
    $protocol = 'https://';
    }
    else
    {
    $protocol = 'http://';
    }
    $host = $_SERVER['HTTP_HOST'];
    if ($_SERVER['HTTP_PORT'] != '' &&
    (($protocol == 'http://' && $_SERVER['HTTP_PORT'] != '80') ||
    ($protocol == 'https://' && $_SERVER['HTTP_PORT'] != '443')))
    {
    $port = ':' . $_SERVER['HTTP_PORT'];
    }
    else
    {
    $port = '';
    }
    return $protocol . $host . $port . $php_request_uri;
    }
    /** Obtain an AuthSub authenticated HTTP client, redirecting the user to the * AuthSub server to login if necessary. */
    function getAuthSubHttpClient(){
    global $_SESSION, $_GET;
    // If there is no AuthSub session or one-time token waiting for us,
    // redirect the user to the AuthSub server to get one.
    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
    // Parameters to give to AuthSub server
    $next = getCurrentUrl();
    $scope = "http://www.google.com/calendar/feeds/";
    $secure = false;
    $session = true;
    // Redirect the user to the AuthSub server to sign in
    $authSubUrl = Zend_Gdata_AuthSub::getAuthSubTokenUri($next,$scope,$secure,$session);
    header("HTTP/1.0 307 Temporary redirect");
    header("Location: " . $authSubUrl);
    exit();
    }
    // Convert an AuthSub one-time token into a session token if needed
    if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
    $_SESSION['sessionToken'] =
    Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
    }
    // At this point we are authenticated via AuthSub and can obtain an
    // authenticated HTTP client instance
    // Create an authenticated HTTP client
    $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
    return $client;
    }
    // -> Script execution begins here <-
    // Make sure http://code.google.com/apis/gdata/re...ml#Queriesthat the user has a valid session, so we can record the
    // AuthSub session token once it is available.
    session_start();
    // Create an instance of the Calendar service, redirecting the user
    // to the AuthSub server if necessary.
    $service = new Zend_Gdata_Calendar(getAuthSubHttpClient());

    ?>

  4. #4
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut Problème résolu
    J'ai réussi à résoudre mon problème. Cela ne venait pas de ce code mais de httpd.conf de apache et php.ini

  5. #5
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2008
    Messages : 4
    Points : 2
    Points
    2
    Par défaut Merci
    Merci quand même de ton aide !!

  6. #6
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Mai 2011
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mai 2011
    Messages : 1
    Points : 1
    Points
    1
    Par défaut meme probleme
    Bonjour,
    j'ai eu le meme probleme que vous, aparament vous avez reglé le probleme en appliquant des modification au niveau de httpd.conf et de apache et php.ini, que ce que vous avez fait exactement !! merci d'avances

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Authentification site externe avec Google Apps
    Par jalalcharaf dans le forum Sécurité
    Réponses: 3
    Dernier message: 19/06/2013, 23h50
  2. [ZF 1.11] probleme avec l'authentification chez google
    Par adel25 dans le forum Zend Framework
    Réponses: 3
    Dernier message: 30/04/2012, 20h21
  3. Pas de fenètre d'authentification avec .htaccess
    Par damjal dans le forum Apache
    Réponses: 2
    Dernier message: 02/11/2005, 08h40
  4. [MySQL] mécanisme d'authentification avec BD
    Par lalyly dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 16/10/2005, 13h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo