|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of BasicLTI4Moodle 00003 // 00004 // Licensed to the Apache Software Foundation (ASF) under one 00005 // or more contributor license agreements. See the NOTICE file 00006 // distributed with this work for additional information 00007 // regarding copyright ownership. The ASF licenses this file 00008 // to you under the Apache License, Version 2.0 (the 00009 // "License"); you may not use this file except in compliance 00010 // with the License. You may obtain a copy of the License at 00011 // 00012 // http://www.apache.org/licenses/LICENSE-2.0 00013 // 00014 // Unless required by applicable law or agreed to in writing, 00015 // software distributed under the License is distributed on an 00016 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00017 // KIND, either express or implied. See the License for the 00018 // specific language governing permissions and limitations 00019 // under the License. 00020 // 00021 // BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability) 00022 // consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web 00023 // based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI 00024 // specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS 00025 // are already supporting or going to support BasicLTI. This project Implements the consumer 00026 // for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas. 00027 // BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem 00028 // at the GESSI research group at UPC. 00029 // SimpleLTI consumer for Moodle is an implementation of the early specification of LTI 00030 // by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a 00031 // Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier. 00032 // 00033 // BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis 00034 // of the Universitat Politecnica de Catalunya http://www.upc.edu 00035 // Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu 00036 // 00037 // Moodle is free software: you can redistribute it and/or modify 00038 // it under the terms of the GNU General Public License as published by 00039 // the Free Software Foundation, either version 3 of the License, or 00040 // (at your option) any later version. 00041 // 00042 // Moodle is distributed in the hope that it will be useful, 00043 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00044 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00045 // GNU General Public License for more details. 00046 // 00047 // You should have received a copy of the GNU General Public License 00048 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00049 00061 namespace moodle\mod\lti;//Using a namespace as the basicLTI module imports classes with the same names 00062 00063 defined('MOODLE_INTERNAL') || die; 00064 00068 class TrivialOAuthDataStore extends OAuthDataStore { 00069 private $consumers = array(); 00070 00071 function add_consumer($consumer_key, $consumer_secret) { 00072 $this->consumers[$consumer_key] = $consumer_secret; 00073 } 00074 00075 function lookup_consumer($consumer_key) { 00076 if ( strpos($consumer_key, "http://" ) === 0 ) { 00077 $consumer = new OAuthConsumer($consumer_key, "secret", null); 00078 return $consumer; 00079 } 00080 if ( $this->consumers[$consumer_key] ) { 00081 $consumer = new OAuthConsumer($consumer_key, $this->consumers[$consumer_key], null); 00082 return $consumer; 00083 } 00084 return null; 00085 } 00086 00087 function lookup_token($consumer, $token_type, $token) { 00088 return new OAuthToken($consumer, ""); 00089 } 00090 00091 // Return NULL if the nonce has not been used 00092 // Return $nonce if the nonce was previously used 00093 function lookup_nonce($consumer, $token, $nonce, $timestamp) { 00094 // Should add some clever logic to keep nonces from 00095 // being reused - for no we are really trusting 00096 // that the timestamp will save us 00097 return null; 00098 } 00099 00100 function new_request_token($consumer) { 00101 return null; 00102 } 00103 00104 function new_access_token($token, $consumer) { 00105 return null; 00106 } 00107 }