[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/ provide

Salut,

On n’est pas obligé de donner une balise de fermeture pour les scripts PHP.

Certains recommandent d’ailleurs de ne pas le faire dans des librairies pour éviter qu’il y ait un espace en trop qui plante PHP : après une fermeture de script, il est toléré qu’il y ait un retour chariot, mais au delà PHP considère que du contenu a été retourné, ce qui bloque ensuite des instructions de type header()

mes 2 cents,

.Gilles

2009/3/3 Pierre Fiches <pierre.fiches@free.fr>

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 :

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 @@
+

  • Oauth (consumer)

+Camille Lafitte
+_ © 2009 - Distribué sous licence GNU/LGPL

  • 0.1
  • <version_base>
  • 0.1
  • </version_base>
  • test

+Gerer des acces via le protcole OAuth (consumer)
+_ Donnons a spip le moyen d’accéder à des services géré par Oauth

  • base/coauth_install.php
  • coauth_options.php
  • declarer_tables_principales
  • base/coauth.php
  • declarer_tables_interfaces
  • base/coauth.php
  • coauth

+

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


spip-zone@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone