[SPIP Zone] [Spip-zone-commit] r27035 - in /_plugins_/_dev_/authentification/oauth: ./ consumer/ provider/ provider/base/ provider/formulaires/ provider/inc/ provider/inc/library/ provider/inc/library/body/ provider/inc/library/discovery/ provider/inc

C'est peut-être fait exprès mais il manque la balise de fermeture de php dans le fichier :
_plugins_/_dev_/authentification/oauth/provider/base/poauth.php

Le 3 mars 09 à 19:53, cam.lafit@azerttyu.net a écrit :

Author: cam.lafit@azerttyu.net
Date: Tue Mar 3 19:52:57 2009
New Revision: 27035

Log:
Nouveau plugin d'authentification utilisant le procotocole Oauth

Principe de découpage :
* 2 sous plugins
* Provider pour gérer les aspects serveur
* Consumer pour l'aspect client

Pour le moment seul '''provider''' est proposé dans une version minimaliste :
* Il faut installer par soit meme les tables oauth tel que exactement précisé dans '''provider/inc/library/store/mysql/mysql.sql'''
* Les services clients doivent etre déclaré en dur
dans la base, une fichier de test est proposé par '''provider/inc/consumer_create.php'''
* les paramétres d'appel à la base de donné via oauth sont déclarés dans '''inc/connecteur_sql.php'''

Pour tester le bon fonctionnement du provider, un client test est accessible via [http://term.ie/oauth/example/client.php term.ie]

La '''library''' est directement posée sur le svn et non simplement liée. Elle a été et va etre modifiée pour être compatible avec l'api SPIP.
De plus elle va être découpée pour repondre à l'approche provider / consumer

Lectures complémentaires :
* [http://oauth.net/ Le protocole]
* [http://www.hueniverse.com/hueniverse/oauth/index.html De la documentation]
* [Google Code Archive - Long-term storage for Google Code Project Hosting. API PHP]

Added:
   _plugins_/_dev_/authentification/oauth/
   _plugins_/_dev_/authentification/oauth/consumer/
   _plugins_/_dev_/authentification/oauth/consumer/plugin.xml
   _plugins_/_dev_/authentification/oauth/provider/
   _plugins_/_dev_/authentification/oauth/provider/base/
   _plugins_/_dev_/authentification/oauth/provider/base/poauth.php
   _plugins_/_dev_/authentification/oauth/provider/base/poauth_install.php
   _plugins_/_dev_/authentification/oauth/provider/formulaires/
   _plugins_/_dev_/authentification/oauth/provider/formulaires/oauth_access_token.html
   _plugins_/_dev_/authentification/oauth/provider/formulaires/oauth_access_token.php
   _plugins_/_dev_/authentification/oauth/provider/formulaires/oauth_authorize_user.html
   _plugins_/_dev_/authentification/oauth/provider/formulaires/oauth_authorize_user.php
   _plugins_/_dev_/authentification/oauth/provider/formulaires/oauth_request_token.html
   _plugins_/_dev_/authentification/oauth/provider/formulaires/oauth_request_token.php
   _plugins_/_dev_/authentification/oauth/provider/inc/
   _plugins_/_dev_/authentification/oauth/provider/inc/OAuthVerifier.php
   _plugins_/_dev_/authentification/oauth/provider/inc/connecteur_sql.php
   _plugins_/_dev_/authentification/oauth/provider/inc/consumer_create.php
   _plugins_/_dev_/authentification/oauth/provider/inc/consummer_list.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthDiscovery.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthException.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthRequest.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthRequestLogger.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthRequestSigner.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthRequestVerifier.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthRequester.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthServer.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/OAuthStore.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/body/
   _plugins_/_dev_/authentification/oauth/provider/inc/library/body/OAuthBodyContentDisposition.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/body/OAuthBodyMultipartFormdata.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/discovery/
   _plugins_/_dev_/authentification/oauth/provider/inc/library/discovery/xrds_parse.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/discovery/xrds_parse.txt
   _plugins_/_dev_/authentification/oauth/provider/inc/library/signature_method/
   _plugins_/_dev_/authentification/oauth/provider/inc/library/signature_method/OAuthSignatureMethod.class.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/signature_method/OAuthSignatureMethod_HMAC_SHA1.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/signature_method/OAuthSignatureMethod_MD5.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/signature_method/OAuthSignatureMethod_PLAINTEXT.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/signature_method/OAuthSignatureMethod_RSA_SHA1.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/OAuthStoreAbstract.class.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/OAuthStoreAnyMeta.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/OAuthStoreMySQL.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/mysql/
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/mysql/install.php
   _plugins_/_dev_/authentification/oauth/provider/inc/library/store/mysql/mysql.sql
   _plugins_/_dev_/authentification/oauth/provider/inclure/
   _plugins_/_dev_/authentification/oauth/provider/inclure/message_authorize.html
   _plugins_/_dev_/authentification/oauth/provider/oauth_access_token.html
   _plugins_/_dev_/authentification/oauth/provider/oauth_authorize.html
   _plugins_/_dev_/authentification/oauth/provider/oauth_request_token.html
   _plugins_/_dev_/authentification/oauth/provider/plugin.xml

Added: _plugins_/_dev_/authentification/oauth/consumer/plugin.xml

--- _plugins_/_dev_/authentification/oauth/consumer/plugin.xml (added)
+++ _plugins_/_dev_/authentification/oauth/consumer/plugin.xml Tue Mar 3 19:52:57 2009
@@ -0,0 +1,43 @@
+<plugin>
+ <nom>
+ Oauth (consumer)
+ </nom>
+ <auteur>
+Camille Lafitte
+_ &#169; 2009 - Distribu&#233; sous licence GNU/LGPL
+ </auteur>
+ <version>
+ 0.1
+ </version>
+ <version_base>
+ 0.1
+ </version_base>
+ <etat>
+ test
+ </etat>
+ <description>
+Gerer des acces via le protcole OAuth (consumer)
+_ Donnons a spip le moyen d'accéder à des services géré par Oauth
+ </description>
+ <lien> </lien>
+
+ <install>base/coauth_install.php</install>
+
+ <options>
+ coauth_options.php
+ </options>
+
+ <pipeline>
+ <nom>declarer_tables_principales</nom>
+ <inclure>base/coauth.php</inclure>
+ </pipeline>
+ <pipeline>
+ <nom>declarer_tables_interfaces</nom>
+ <inclure>base/coauth.php</inclure>
+ </pipeline>
+
+ <prefix>
+ coauth
+ </prefix>
+</plugin>

Added: _plugins_/_dev_/authentification/oauth/provider/base/poauth.php

--- _plugins_/_dev_/authentification/oauth/provider/base/poauth.php (added)
+++ _plugins_/_dev_/authentification/oauth/provider/base/poauth.php Tue Mar 3 19:52:57 2009
@@ -0,0 +1,112 @@
+<?php
+if (!defined("_ECRIRE_INC_VERSION")) return;
+
+function poauth_declarer_tables_principales($tables_principales){
+
+ # Table holding consumer key/secret combos an user issued to consumers.
+ $osr_field = array(
+ 'osr_id' => "INT(11) NOT NULL AUTO_INCREMENT",
+ 'osr_usa_id_ref' => "INT(11)",
+ 'osr_consumer_key' => "VARCHAR(255) binary not null",
+ 'osr_consumer_secret' => "VARCHAR(255) binary not null",
+ 'osr_enabled' => "tinyint(1) not null default '1'",
+ 'osr_status' => "VARCHAR(255) binary not null",
+ 'osr_requester_name' => "VARCHAR(255) binary not null",
+ 'osr_requester_email' => "VARCHAR(255) binary not null",
+ 'osr_callback_uri' => "VARCHAR(255) binary not null",
+ 'osr_application_uri' => "VARCHAR(255) binary not null",
+ 'osr_application_title' => "VARCHAR(255) not null",
+ 'osr_application_descr' => "TEXT not null",
+ 'osr_application_notes' => "TEXT not null",
+ 'osr_application_type' => "VARCHAR(255) binary not null",
+ 'osr_application_commercial' => "tinyint(1) not null default '0'",
+ 'osr_issue_date' => "DATETIME not null",
+ 'osr_timestamp' => "TIMESTAMP not null default current_TIMESTAMP"
+ );
+
+ $osr_key = array(
+ 'PRIMARY KEY osr_id' => "osr_id",
+ 'UNIQUE KEY osr_consummer_key' =>"osr_consumer_key",
+ 'KEY osr_usa_id_ref' => "osr_usa_id_ref"
+ );
+
+ $osr_join = array(
+ );
+
+ $tables_principales['oauth_server_registry'] = array(
+ 'field' => &$osr_field,
+ 'key' => &$osr_key,
+ 'join'=>&$osr_join
+ );
+
+ # Nonce used by a certain consumer, every used nonce should be unique, this prevents
+ # replaying attacks. We need to store all TIMESTAMP/nonce combinations for the
+ # maximum TIMESTAMP received.
+ $osn_field = array(
+ "osn_id" => "INT(11) not null auto_increment",
+ "osn_consumer_key" => "VARCHAR(64) binary not null",
+ "osn_token" =>"VARCHAR(64) binary not null",
+ "osn_timestamp" => "TIMESTAMP not null",
+ "osn_nonce" => "VARCHAR(80) binary not null"
+ );
+
+ $osn_key = array(
+ "PRIMARY KEY" => "osn_id",
+ "UNIQUE KEY" => "osn_consumer_key, osn_token, osn_timestamp, osn_nonce"
+ );
+
+ $osn_join = array(
+ );
+
+ $tables_principales['oauth_server_nonce'] = array(
+ 'field' => &$osn_field,
+ 'key' => &$osn_key,
+ 'join'=>&$osn_join
+ );
+
+ # Table used to sign requests sent to a server by the consumer
+ # The key is defined for a particular user, when the user id is null then this
+ # is the default authentication for communication with the remote server

[... 6801 lines stripped ...]
_______________________________________________
Spip-zone-commit@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone-commit