Wordpress multisite
parent
80c5df87b4
commit
ae20883de1
|
@ -13,3 +13,6 @@
|
|||
[submodule "docker/moodle/rootfs-php7"]
|
||||
path = docker/moodle/rootfs-php7
|
||||
url = https://github.com/erseco/alpine-php7-webserver.git
|
||||
[submodule "docker/wordpress/plugins/saml"]
|
||||
path = docker/wordpress/plugins/saml
|
||||
url = https://github.com/onelogin/wordpress-saml.git
|
||||
|
|
|
@ -14,9 +14,9 @@ FROM erseco/alpine-moodle
|
|||
# COPY rootfs/isinstalled.php /
|
||||
# COPY plugins.sh /
|
||||
# USER root
|
||||
RUN curl --location https://moodle.org/plugins/download.php/23298/auth_oidc_moodle310_2020110900.zip > auth_oidc.zip
|
||||
RUN unzip auth_oidc.zip -d /var/www/html/auth/
|
||||
RUN rm auth_oidc.zip
|
||||
#RUN curl --location https://moodle.org/plugins/download.php/23298/auth_oidc_moodle310_2020110900.zip > auth_oidc.zip
|
||||
#RUN unzip auth_oidc.zip -d /var/www/html/auth/
|
||||
#RUN rm auth_oidc.zip
|
||||
|
||||
RUN curl --location https://moodle.org/plugins/download.php/23360/mod_jitsi_moodle310_2021020300.zip > jitsi.zip
|
||||
RUN unzip jitsi.zip -d /var/www/html/mod/
|
||||
|
|
|
@ -6,4 +6,31 @@ rm jitsi.zip
|
|||
|
||||
curl --location https://moodle.org/plugins/download.php/23294/mod_bigbluebuttonbn_moodle310_2019101004.zip > bbb.zip
|
||||
unzip bbb.zip -d /var/www/html/mod/
|
||||
rm bbb.zip
|
||||
rm bbb.zip
|
||||
|
||||
curl --location https://github.com/3iPunt/moodle_mod_tresipuntshare/archive/refs/heads/master.zip > tresipuntshare.zip
|
||||
unzip tresipuntshare.zip -d /var/www/html/mod/
|
||||
mv /var/www/html/mod/moodle_mod_tresipuntshare-master /var/www/html/mod/tresipuntshare
|
||||
rm tresipuntshare.zip
|
||||
|
||||
curl --location https://github.com/3iPunt/moodle_mod_tresipuntvideo/archive/refs/heads/master.zip > tresipuntvideo.zip
|
||||
unzip tresipuntvideo.zip -d /var/www/html/mod/
|
||||
mv /var/www/html/mod/moodle_mod_tresipuntvideo-master /var/www/html/mod/tresipuntvideo
|
||||
rm tresipuntvideo.zip
|
||||
|
||||
curl --location https://github.com/3iPunt/moodle_mod_tresipuntaudio/archive/refs/heads/master.zip > tresipuntaudio.zip
|
||||
unzip tresipuntaudio.zip -d /var/www/html/mod/
|
||||
mv /var/www/html/mod/moodle_mod_tresipuntaudio-master /var/www/html/mod/tresipuntaudio
|
||||
rm tresipuntaudio.zip
|
||||
|
||||
curl --location https://github.com/3iPunt/moodle_mod_tresipuntaudio/archive/refs/heads/master.zip > tresipuntaudio.zip
|
||||
unzip tresipuntaudio.zip -d /var/www/html/mod/
|
||||
mv /var/www/html/mod/moodle_mod_tresipuntaudio-master /var/www/html/mod/tresipuntaudio
|
||||
rm tresipuntaudio.zip
|
||||
|
||||
curl --location https://github.com/3iPunt/moodle_theme_cbe/archive/refs/heads/master.zip > tresipunt_theme_cbe.zip
|
||||
unzip tresipunt_theme_cbe.zip -d /var/www/html/mod/
|
||||
mv /var/www/html/mod/moodle_theme_cbe-master /var/www/html/theme/cbe
|
||||
rm tresipunt_theme_cbe.zip
|
||||
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
*~
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit14889e338c101f45bb4a1ad143015514::getLoader();
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"name": "ownpad/3rdparty",
|
||||
"description": "3rdparty components for ownpad",
|
||||
"license": "MIT",
|
||||
"config": {
|
||||
"vendor-dir": ".",
|
||||
"optimize-autoloader": true,
|
||||
"classmap-authoritative": true
|
||||
},
|
||||
"require": {
|
||||
"tomnomnom/etherpad-lite-client": "^0.1.2"
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "e64780f152a2832ab031c092c6f06e4c",
|
||||
"content-hash": "9fc763c2fb7f95634e8033a460de17c7",
|
||||
"packages": [
|
||||
{
|
||||
"name": "tomnomnom/etherpad-lite-client",
|
||||
"version": "0.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TomNomNom/etherpad-lite-client.git",
|
||||
"reference": "932ac4903d7982038d5d04c03f8f9c809a5356bd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/TomNomNom/etherpad-lite-client/zipball/932ac4903d7982038d5d04c03f8f9c809a5356bd",
|
||||
"reference": "932ac4903d7982038d5d04c03f8f9c809a5356bd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"EtherpadLite\\": "EtherpadLite/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache"
|
||||
],
|
||||
"description": "Etherpad Lite client for PHP",
|
||||
"homepage": "https://github.com/TomNomNom/etherpad-lite-client/",
|
||||
"time": "2016-02-09 14:27:44"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
Binary file not shown.
|
@ -1,413 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see http://www.php-fig.org/psr/psr-0/
|
||||
* @see http://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
||||
if ('\\' == $class[0]) {
|
||||
$class = substr($class, 1);
|
||||
}
|
||||
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if ($file === null && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if ($file === null) {
|
||||
// Remember that this class does not exist.
|
||||
return $this->classMap[$class] = false;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = $vendorDir;
|
||||
|
||||
return array(
|
||||
'EtherpadLite\\Client' => $vendorDir . '/tomnomnom/etherpad-lite-client/EtherpadLite/Client.php',
|
||||
);
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = $vendorDir;
|
||||
|
||||
return array(
|
||||
);
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = $vendorDir;
|
||||
|
||||
return array(
|
||||
'EtherpadLite\\' => array($vendorDir . '/tomnomnom/etherpad-lite-client/EtherpadLite'),
|
||||
);
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit14889e338c101f45bb4a1ad143015514
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit14889e338c101f45bb4a1ad143015514', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit14889e338c101f45bb4a1ad143015514', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit14889e338c101f45bb4a1ad143015514::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit14889e338c101f45bb4a1ad143015514
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'E' =>
|
||||
array (
|
||||
'EtherpadLite\\' => 13,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'EtherpadLite\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/tomnomnom/etherpad-lite-client/EtherpadLite',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'EtherpadLite\\Client' => __DIR__ . '/..' . '/tomnomnom/etherpad-lite-client/EtherpadLite/Client.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit14889e338c101f45bb4a1ad143015514::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit14889e338c101f45bb4a1ad143015514::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit14889e338c101f45bb4a1ad143015514::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "tomnomnom/etherpad-lite-client",
|
||||
"version": "0.1.2",
|
||||
"version_normalized": "0.1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TomNomNom/etherpad-lite-client.git",
|
||||
"reference": "932ac4903d7982038d5d04c03f8f9c809a5356bd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/TomNomNom/etherpad-lite-client/zipball/932ac4903d7982038d5d04c03f8f9c809a5356bd",
|
||||
"reference": "932ac4903d7982038d5d04c03f8f9c809a5356bd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"time": "2016-02-09 14:27:44",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"EtherpadLite\\": "EtherpadLite/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache"
|
||||
],
|
||||
"description": "Etherpad Lite client for PHP",
|
||||
"homepage": "https://github.com/TomNomNom/etherpad-lite-client/"
|
||||
}
|
||||
]
|
|
@ -1,4 +0,0 @@
|
|||
*.swp
|
||||
vendor
|
||||
composer.lock
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
Tag: api-v1
|
||||
* All v1 methods implemented.
|
||||
* Start of changelog.
|
||||
|
||||
Tag: api-v1.1 (2012-11-17)
|
||||
* Added v1.1 methods:
|
||||
- listAllGroups
|
||||
- getAuthorName
|
||||
- padUsers
|
||||
- sendClientsMessage
|
||||
|
||||
Tag: api-v.1.2.11 (2015-03-22)
|
||||
* Autogeneration of client methods
|
||||
* Test Suite
|
||||
|
||||
2015-10-07:
|
||||
* Converts boolean arguments to strings
|
|
@ -1,575 +0,0 @@
|
|||
<?php
|
||||
// The following code is automatically generated by ./tools/generate.php
|
||||
// please edit the files in ./tools/templates/ instead of editing this
|
||||
// file directly.
|
||||
|
||||
namespace EtherpadLite;
|
||||
|
||||
class Client {
|
||||
|
||||
const API_VERSION = '1.2.11';
|
||||
|
||||
const CODE_OK = 0;
|
||||
const CODE_INVALID_PARAMETERS = 1;
|
||||
const CODE_INTERNAL_ERROR = 2;
|
||||
const CODE_INVALID_FUNCTION = 3;
|
||||
const CODE_INVALID_API_KEY = 4;
|
||||
|
||||
protected $apiKey = "";
|
||||
protected $baseUrl = "http://localhost:9001/api";
|
||||
|
||||
public function __construct($apiKey, $baseUrl = null){
|
||||
if (strlen($apiKey) < 1){
|
||||
throw new \InvalidArgumentException("[{$apiKey}] is not a valid API key");
|
||||
}
|
||||
$this->apiKey = $apiKey;
|
||||
|
||||
if (isset($baseUrl)){
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
if (!filter_var($this->baseUrl, FILTER_VALIDATE_URL)){
|
||||
throw new \InvalidArgumentException("[{$this->baseUrl}] is not a valid URL");
|
||||
}
|
||||
}
|
||||
|
||||
protected function get($function, array $arguments = array()){
|
||||
return $this->call($function, $arguments, 'GET');
|
||||
}
|
||||
|
||||
protected function post($function, array $arguments = array()){
|
||||
return $this->call($function, $arguments, 'POST');
|
||||
}
|
||||
|
||||
protected function convertBools($candidate){
|
||||
if (is_bool($candidate)){
|
||||
return $candidate? "true" : "false";
|
||||
}
|
||||
return $candidate;
|
||||
}
|
||||
|
||||
protected function call($function, array $arguments = array(), $method = 'GET'){
|
||||
$arguments['apikey'] = $this->apiKey;
|
||||
$arguments = array_map(array($this, 'convertBools'), $arguments);
|
||||
$arguments = http_build_query($arguments, '', '&');
|
||||
$url = $this->baseUrl."/".self::API_VERSION."/".$function;
|
||||
if ($method !== 'POST'){
|
||||
$url .= "?".$arguments;
|
||||
}
|
||||
// use curl of it's available
|
||||
if (function_exists('curl_init')){
|
||||
$c = curl_init($url);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_TIMEOUT, 20);
|
||||
if ($method === 'POST'){
|
||||
curl_setopt($c, CURLOPT_POST, true);
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $arguments);
|
||||
}
|
||||
$result = curl_exec($c);
|
||||
curl_close($c);
|
||||
// fallback to plain php
|
||||
} else {
|
||||
$params = array('http' => array('method' => $method, 'ignore_errors' => true, 'header' => 'Content-Type:application/x-www-form-urlencoded'));
|
||||
if ($method === 'POST'){
|
||||
$params['http']['content'] = $arguments;
|
||||
}
|
||||
$context = stream_context_create($params);
|
||||
$fp = fopen($url, 'rb', false, $context);
|
||||
$result = $fp ? stream_get_contents($fp) : null;
|
||||
}
|
||||
|
||||
if(!$result){
|
||||
throw new \UnexpectedValueException("Empty or No Response from the server");
|
||||
}
|
||||
|
||||
$result = json_decode($result);
|
||||
if ($result === null){
|
||||
throw new \UnexpectedValueException("JSON response could not be decoded");
|
||||
}
|
||||
return $this->handleResult($result);
|
||||
}
|
||||
|
||||
protected function handleResult($result){
|
||||
if (!isset($result->code)){
|
||||
throw new \RuntimeException("API response has no code");
|
||||
}
|
||||
if (!isset($result->message)){
|
||||
throw new \RuntimeException("API response has no message");
|
||||
}
|
||||
if (!isset($result->data)){
|
||||
$result->data = null;
|
||||
}
|
||||
|
||||
switch ($result->code){
|
||||
case self::CODE_OK:
|
||||
return $result->data;
|
||||
case self::CODE_INVALID_PARAMETERS:
|
||||
case self::CODE_INVALID_API_KEY:
|
||||
throw new \InvalidArgumentException($result->message);
|
||||
case self::CODE_INTERNAL_ERROR:
|
||||
throw new \RuntimeException($result->message);
|
||||
case self::CODE_INVALID_FUNCTION:
|
||||
throw new \BadFunctionCallException($result->message);
|
||||
default:
|
||||
throw new \RuntimeException("An unexpected error occurred whilst handling the response");
|
||||
}
|
||||
}
|
||||
|
||||
// createGroup
|
||||
public function createGroup(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->post("createGroup", $params);
|
||||
}
|
||||
|
||||
// createGroupIfNotExistsFor
|
||||
public function createGroupIfNotExistsFor($groupMapper){
|
||||
$params = array();
|
||||
|
||||
$params['groupMapper'] = $groupMapper;
|
||||
|
||||
return $this->post("createGroupIfNotExistsFor", $params);
|
||||
}
|
||||
|
||||
// deleteGroup
|
||||
public function deleteGroup($groupID){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
|
||||
return $this->post("deleteGroup", $params);
|
||||
}
|
||||
|
||||
// listPads
|
||||
public function listPads($groupID){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
|
||||
return $this->get("listPads", $params);
|
||||
}
|
||||
|
||||
// listAllPads
|
||||
public function listAllPads(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->get("listAllPads", $params);
|
||||
}
|
||||
|
||||
// createDiffHTML
|
||||
public function createDiffHTML($padID, $startRev, $endRev){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['startRev'] = $startRev;
|
||||
$params['endRev'] = $endRev;
|
||||
|
||||
return $this->post("createDiffHTML", $params);
|
||||
}
|
||||
|
||||
// createPad
|
||||
public function createPad($padID, $text = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($text)){
|
||||
$params['text'] = $text;
|
||||
}
|
||||
|
||||
return $this->post("createPad", $params);
|
||||
}
|
||||
|
||||
// createGroupPad
|
||||
public function createGroupPad($groupID, $padName, $text = null){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
$params['padName'] = $padName;
|
||||
if (isset($text)){
|
||||
$params['text'] = $text;
|
||||
}
|
||||
|
||||
return $this->post("createGroupPad", $params);
|
||||
}
|
||||
|
||||
// createAuthor
|
||||
public function createAuthor($name = null){
|
||||
$params = array();
|
||||
|
||||
if (isset($name)){
|
||||
$params['name'] = $name;
|
||||
}
|
||||
|
||||
return $this->post("createAuthor", $params);
|
||||
}
|
||||
|
||||
// createAuthorIfNotExistsFor
|
||||
public function createAuthorIfNotExistsFor($authorMapper, $name = null){
|
||||
$params = array();
|
||||
|
||||
$params['authorMapper'] = $authorMapper;
|
||||
if (isset($name)){
|
||||
$params['name'] = $name;
|
||||
}
|
||||
|
||||
return $this->post("createAuthorIfNotExistsFor", $params);
|
||||
}
|
||||
|
||||
// listPadsOfAuthor
|
||||
public function listPadsOfAuthor($authorID){
|
||||
$params = array();
|
||||
|
||||
$params['authorID'] = $authorID;
|
||||
|
||||
return $this->get("listPadsOfAuthor", $params);
|
||||
}
|
||||
|
||||
// createSession
|
||||
public function createSession($groupID, $authorID, $validUntil){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
$params['authorID'] = $authorID;
|
||||
$params['validUntil'] = $validUntil;
|
||||
|
||||
return $this->post("createSession", $params);
|
||||
}
|
||||
|
||||
// deleteSession
|
||||
public function deleteSession($sessionID){
|
||||
$params = array();
|
||||
|
||||
$params['sessionID'] = $sessionID;
|
||||
|
||||
return $this->post("deleteSession", $params);
|
||||
}
|
||||
|
||||
// getSessionInfo
|
||||
public function getSessionInfo($sessionID){
|
||||
$params = array();
|
||||
|
||||
$params['sessionID'] = $sessionID;
|
||||
|
||||
return $this->get("getSessionInfo", $params);
|
||||
}
|
||||
|
||||
// listSessionsOfGroup
|
||||
public function listSessionsOfGroup($groupID){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
|
||||
return $this->get("listSessionsOfGroup", $params);
|
||||
}
|
||||
|
||||
// listSessionsOfAuthor
|
||||
public function listSessionsOfAuthor($authorID){
|
||||
$params = array();
|
||||
|
||||
$params['authorID'] = $authorID;
|
||||
|
||||
return $this->get("listSessionsOfAuthor", $params);
|
||||
}
|
||||
|
||||
// getText
|
||||
public function getText($padID, $rev = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($rev)){
|
||||
$params['rev'] = $rev;
|
||||
}
|
||||
|
||||
return $this->get("getText", $params);
|
||||
}
|
||||
|
||||
// setText
|
||||
public function setText($padID, $text){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['text'] = $text;
|
||||
|
||||
return $this->post("setText", $params);
|
||||
}
|
||||
|
||||
// getHTML
|
||||
public function getHTML($padID, $rev = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($rev)){
|
||||
$params['rev'] = $rev;
|
||||
}
|
||||
|
||||
return $this->get("getHTML", $params);
|
||||
}
|
||||
|
||||
// setHTML
|
||||
public function setHTML($padID, $html){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['html'] = $html;
|
||||
|
||||
return $this->post("setHTML", $params);
|
||||
}
|
||||
|
||||
// getAttributePool
|
||||
public function getAttributePool($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getAttributePool", $params);
|
||||
}
|
||||
|
||||
// getRevisionsCount
|
||||
public function getRevisionsCount($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getRevisionsCount", $params);
|
||||
}
|
||||
|
||||
// getSavedRevisionsCount
|
||||
public function getSavedRevisionsCount($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getSavedRevisionsCount", $params);
|
||||
}
|
||||
|
||||
// listSavedRevisions
|
||||
public function listSavedRevisions($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("listSavedRevisions", $params);
|
||||
}
|
||||
|
||||
// saveRevision
|
||||
public function saveRevision($padID, $rev){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['rev'] = $rev;
|
||||
|
||||
return $this->post("saveRevision", $params);
|
||||
}
|
||||
|
||||
// getRevisionChangeset
|
||||
public function getRevisionChangeset($padID, $rev = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($rev)){
|
||||
$params['rev'] = $rev;
|
||||
}
|
||||
|
||||
return $this->get("getRevisionChangeset", $params);
|
||||
}
|
||||
|
||||
// getLastEdited
|
||||
public function getLastEdited($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getLastEdited", $params);
|
||||
}
|
||||
|
||||
// deletePad
|
||||
public function deletePad($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->post("deletePad", $params);
|
||||
}
|
||||
|
||||
// copyPad
|
||||
public function copyPad($sourceID, $destinationID, $force = null){
|
||||
$params = array();
|
||||
|
||||
$params['sourceID'] = $sourceID;
|
||||
$params['destinationID'] = $destinationID;
|
||||
if (isset($force)){
|
||||
$params['force'] = $force;
|
||||
}
|
||||
|
||||
return $this->post("copyPad", $params);
|
||||
}
|
||||
|
||||
// movePad
|
||||
public function movePad($sourceID, $destinationID, $force = null){
|
||||
$params = array();
|
||||
|
||||
$params['sourceID'] = $sourceID;
|
||||
$params['destinationID'] = $destinationID;
|
||||
if (isset($force)){
|
||||
$params['force'] = $force;
|
||||
}
|
||||
|
||||
return $this->post("movePad", $params);
|
||||
}
|
||||
|
||||
// getReadOnlyID
|
||||
public function getReadOnlyID($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getReadOnlyID", $params);
|
||||
}
|
||||
|
||||
// getPadID
|
||||
public function getPadID($roID){
|
||||
$params = array();
|
||||
|
||||
$params['roID'] = $roID;
|
||||
|
||||
return $this->get("getPadID", $params);
|
||||
}
|
||||
|
||||
// setPublicStatus
|
||||
public function setPublicStatus($padID, $publicStatus){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['publicStatus'] = $publicStatus;
|
||||
|
||||
return $this->post("setPublicStatus", $params);
|
||||
}
|
||||
|
||||
// getPublicStatus
|
||||
public function getPublicStatus($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getPublicStatus", $params);
|
||||
}
|
||||
|
||||
// setPassword
|
||||
public function setPassword($padID, $password){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['password'] = $password;
|
||||
|
||||
return $this->post("setPassword", $params);
|
||||
}
|
||||
|
||||
// isPasswordProtected
|
||||
public function isPasswordProtected($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("isPasswordProtected", $params);
|
||||
}
|
||||
|
||||
// listAuthorsOfPad
|
||||
public function listAuthorsOfPad($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("listAuthorsOfPad", $params);
|
||||
}
|
||||
|
||||
// padUsersCount
|
||||
public function padUsersCount($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("padUsersCount", $params);
|
||||
}
|
||||
|
||||
// getAuthorName
|
||||
public function getAuthorName($authorID){
|
||||
$params = array();
|
||||
|
||||
$params['authorID'] = $authorID;
|
||||
|
||||
return $this->get("getAuthorName", $params);
|
||||
}
|
||||
|
||||
// padUsers
|
||||
public function padUsers($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("padUsers", $params);
|
||||
}
|
||||
|
||||
// sendClientsMessage
|
||||
public function sendClientsMessage($padID, $msg){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['msg'] = $msg;
|
||||
|
||||
return $this->post("sendClientsMessage", $params);
|
||||
}
|
||||
|
||||
// listAllGroups
|
||||
public function listAllGroups(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->get("listAllGroups", $params);
|
||||
}
|
||||
|
||||
// checkToken
|
||||
public function checkToken(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->post("checkToken", $params);
|
||||
}
|
||||
|
||||
// getChatHistory
|
||||
public function getChatHistory($padID, $start = null, $end = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($start)){
|
||||
$params['start'] = $start;
|
||||
}
|
||||
if (isset($end)){
|
||||
$params['end'] = $end;
|
||||
}
|
||||
|
||||
return $this->get("getChatHistory", $params);
|
||||
}
|
||||
|
||||
// getChatHead
|
||||
public function getChatHead($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getChatHead", $params);
|
||||
}
|
||||
|
||||
// restoreRevision
|
||||
public function restoreRevision($padID, $rev){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['rev'] = $rev;
|
||||
|
||||
return $this->post("restoreRevision", $params);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
test:
|
||||
./vendor/bin/phpunit --colors --verbose
|
||||
|
||||
dev-deps:
|
||||
composer install --dev
|
||||
|
||||
client:
|
||||
php ./tools/generate.php > ./EtherpadLite/Client.php
|
||||
|
||||
.PHONY: all test clean
|
|
@ -1,45 +0,0 @@
|
|||
# PHP Etherpad Lite Client
|
||||
This PHP Etherpad Lite class allows you to easily interact with Etherpad Lite API with PHP.
|
||||
Etherpad Lite is a collaborative editor provided by the Etherpad Foundation (http://etherpad.org)
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Install from packagist:
|
||||
|
||||
```
|
||||
composer require tomnomnom/etherpad-lite-client
|
||||
```
|
||||
|
||||
A legacy `etherpad-lite-client.php` file is included for people who are unwilling/unable to switch to the new
|
||||
namespaced version, but it is deprecated and will be removed in future versions.
|
||||
|
||||
```php
|
||||
<?php
|
||||
require 'vendor/autoload.php';
|
||||
$instance = new EtherpadLite\Client('EtherpadFTW', 'http://beta.etherpad.org/api');
|
||||
$revisionCount = $instance->getRevisionsCount('testPad');
|
||||
$revisionCount = $revisionCount->revisions;
|
||||
echo "Pad has $revisionCount revisions";
|
||||
```
|
||||
|
||||
# Running The Tests
|
||||
The full-stack tests can be run by running `make test`.
|
||||
|
||||
The test suite makes the following assumptions:
|
||||
|
||||
* A copy of Etherpad is running at http://localhost:9001
|
||||
* The data in the running instance of Etherpad can be destroyed
|
||||
* The APIKey for the running instance is 'dcf118bfc58cc69cdf3ae870071f97149924f5f5a9a4a552fd2921b40830aaae'
|
||||
* PHPUnit has been installed with [Composer](https://getcomposer.org/) (run `make dev-deps`)
|
||||
|
||||
A Dockerfile is provided in `tools/testcontainer` to ease setup of a test instance.
|
||||
|
||||
# License
|
||||
|
||||
Apache License
|
||||
|
||||
# Other Stuff
|
||||
|
||||
The Etherpad Foundation also provides a jQuery plugin for Etherpad Lite.
|
||||
This can be found at http://etherpad.org/2011/08/14/etherpad-lite-jquery-plugin/
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
{
|
||||
"version": "1.2.11",
|
||||
"methods":
|
||||
{ "createGroup" : []
|
||||
, "createGroupIfNotExistsFor" : ["groupMapper"]
|
||||
, "deleteGroup" : ["groupID"]
|
||||
, "listPads" : ["groupID"]
|
||||
, "listAllPads" : []
|
||||
, "createDiffHTML" : ["padID", "startRev", "endRev"]
|
||||
, "createPad" : ["padID", "[text]"]
|
||||
, "createGroupPad" : ["groupID", "padName", "[text]"]
|
||||
, "createAuthor" : ["[name]"]
|
||||
, "createAuthorIfNotExistsFor": ["authorMapper" , "[name]"]
|
||||
, "listPadsOfAuthor" : ["authorID"]
|
||||
, "createSession" : ["groupID", "authorID", "validUntil"]
|
||||
, "deleteSession" : ["sessionID"]
|
||||
, "getSessionInfo" : ["sessionID"]
|
||||
, "listSessionsOfGroup" : ["groupID"]
|
||||
, "listSessionsOfAuthor" : ["authorID"]
|
||||
, "getText" : ["padID", "[rev]"]
|
||||
, "setText" : ["padID", "text"]
|
||||
, "getHTML" : ["padID", "[rev]"]
|
||||
, "setHTML" : ["padID", "html"]
|
||||
, "getAttributePool" : ["padID"]
|
||||
, "getRevisionsCount" : ["padID"]
|
||||
, "getSavedRevisionsCount" : ["padID"]
|
||||
, "listSavedRevisions" : ["padID"]
|
||||
, "saveRevision" : ["padID", "rev"]
|
||||
, "getRevisionChangeset" : ["padID", "[rev]"]
|
||||
, "getLastEdited" : ["padID"]
|
||||
, "deletePad" : ["padID"]
|
||||
, "copyPad" : ["sourceID", "destinationID", "[force]"]
|
||||
, "movePad" : ["sourceID", "destinationID", "[force]"]
|
||||
, "getReadOnlyID" : ["padID"]
|
||||
, "getPadID" : ["roID"]
|
||||
, "setPublicStatus" : ["padID", "publicStatus"]
|
||||
, "getPublicStatus" : ["padID"]
|
||||
, "setPassword" : ["padID", "password"]
|
||||
, "isPasswordProtected" : ["padID"]
|
||||
, "listAuthorsOfPad" : ["padID"]
|
||||
, "padUsersCount" : ["padID"]
|
||||
, "getAuthorName" : ["authorID"]
|
||||
, "padUsers" : ["padID"]
|
||||
, "sendClientsMessage" : ["padID", "msg"]
|
||||
, "listAllGroups" : []
|
||||
, "checkToken" : []
|
||||
, "getChatHistory" : ["padID", "[start]", "[end]"]
|
||||
, "getChatHead" : ["padID"]
|
||||
, "restoreRevision" : ["padID", "rev"]
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"name": "tomnomnom/etherpad-lite-client",
|
||||
"description": "Etherpad Lite client for PHP",
|
||||
"homepage": "https://github.com/TomNomNom/etherpad-lite-client/",
|
||||
"license": "Apache",
|
||||
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {"EtherpadLite\\": "EtherpadLite/"}
|
||||
}
|
||||
}
|
|
@ -1,573 +0,0 @@
|
|||
<?php
|
||||
// The following code is automatically generated by ./tools/generate.php
|
||||
// please edit the files in ./tools/templates/ instead of editing this
|
||||
// file directly.
|
||||
|
||||
class EtherpadLiteClient {
|
||||
|
||||
const API_VERSION = '1.2.11';
|
||||
|
||||
const CODE_OK = 0;
|
||||
const CODE_INVALID_PARAMETERS = 1;
|
||||
const CODE_INTERNAL_ERROR = 2;
|
||||
const CODE_INVALID_FUNCTION = 3;
|
||||
const CODE_INVALID_API_KEY = 4;
|
||||
|
||||
protected $apiKey = "";
|
||||
protected $baseUrl = "http://localhost:9001/api";
|
||||
|
||||
public function __construct($apiKey, $baseUrl = null){
|
||||
if (strlen($apiKey) < 1){
|
||||
throw new InvalidArgumentException("[{$apiKey}] is not a valid API key");
|
||||
}
|
||||
$this->apiKey = $apiKey;
|
||||
|
||||
if (isset($baseUrl)){
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
if (!filter_var($this->baseUrl, FILTER_VALIDATE_URL)){
|
||||
throw new InvalidArgumentException("[{$this->baseUrl}] is not a valid URL");
|
||||
}
|
||||
}
|
||||
|
||||
protected function get($function, array $arguments = array()){
|
||||
return $this->call($function, $arguments, 'GET');
|
||||
}
|
||||
|
||||
protected function post($function, array $arguments = array()){
|
||||
return $this->call($function, $arguments, 'POST');
|
||||
}
|
||||
|
||||
protected function convertBools($candidate){
|
||||
if (is_bool($candidate)){
|
||||
return $candidate? "true" : "false";
|
||||
}
|
||||
return $candidate;
|
||||
}
|
||||
|
||||
protected function call($function, array $arguments = array(), $method = 'GET'){
|
||||
$arguments['apikey'] = $this->apiKey;
|
||||
$arguments = array_map(array($this, 'convertBools'), $arguments);
|
||||
$arguments = http_build_query($arguments, '', '&');
|
||||
$url = $this->baseUrl."/".self::API_VERSION."/".$function;
|
||||
if ($method !== 'POST'){
|
||||
$url .= "?".$arguments;
|
||||
}
|
||||
// use curl of it's available
|
||||
if (function_exists('curl_init')){
|
||||
$c = curl_init($url);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_TIMEOUT, 20);
|
||||
if ($method === 'POST'){
|
||||
curl_setopt($c, CURLOPT_POST, true);
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $arguments);
|
||||
}
|
||||
$result = curl_exec($c);
|
||||
curl_close($c);
|
||||
// fallback to plain php
|
||||
} else {
|
||||
$params = array('http' => array('method' => $method, 'ignore_errors' => true, 'header' => 'Content-Type:application/x-www-form-urlencoded'));
|
||||
if ($method === 'POST'){
|
||||
$params['http']['content'] = $arguments;
|
||||
}
|
||||
$context = stream_context_create($params);
|
||||
$fp = fopen($url, 'rb', false, $context);
|
||||
$result = $fp ? stream_get_contents($fp) : null;
|
||||
}
|
||||
|
||||
if(!$result){
|
||||
throw new UnexpectedValueException("Empty or No Response from the server");
|
||||
}
|
||||
|
||||
$result = json_decode($result);
|
||||
if ($result === null){
|
||||
throw new UnexpectedValueException("JSON response could not be decoded");
|
||||
}
|
||||
return $this->handleResult($result);
|
||||
}
|
||||
|
||||
protected function handleResult($result){
|
||||
if (!isset($result->code)){
|
||||
throw new RuntimeException("API response has no code");
|
||||
}
|
||||
if (!isset($result->message)){
|
||||
throw new RuntimeException("API response has no message");
|
||||
}
|
||||
if (!isset($result->data)){
|
||||
$result->data = null;
|
||||
}
|
||||
|
||||
switch ($result->code){
|
||||
case self::CODE_OK:
|
||||
return $result->data;
|
||||
case self::CODE_INVALID_PARAMETERS:
|
||||
case self::CODE_INVALID_API_KEY:
|
||||
throw new InvalidArgumentException($result->message);
|
||||
case self::CODE_INTERNAL_ERROR:
|
||||
throw new RuntimeException($result->message);
|
||||
case self::CODE_INVALID_FUNCTION:
|
||||
throw new BadFunctionCallException($result->message);
|
||||
default:
|
||||
throw new RuntimeException("An unexpected error occurred whilst handling the response");
|
||||
}
|
||||
}
|
||||
|
||||
// createGroup
|
||||
public function createGroup(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->post("createGroup", $params);
|
||||
}
|
||||
|
||||
// createGroupIfNotExistsFor
|
||||
public function createGroupIfNotExistsFor($groupMapper){
|
||||
$params = array();
|
||||
|
||||
$params['groupMapper'] = $groupMapper;
|
||||
|
||||
return $this->post("createGroupIfNotExistsFor", $params);
|
||||
}
|
||||
|
||||
// deleteGroup
|
||||
public function deleteGroup($groupID){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
|
||||
return $this->post("deleteGroup", $params);
|
||||
}
|
||||
|
||||
// listPads
|
||||
public function listPads($groupID){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
|
||||
return $this->get("listPads", $params);
|
||||
}
|
||||
|
||||
// listAllPads
|
||||
public function listAllPads(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->get("listAllPads", $params);
|
||||
}
|
||||
|
||||
// createDiffHTML
|
||||
public function createDiffHTML($padID, $startRev, $endRev){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['startRev'] = $startRev;
|
||||
$params['endRev'] = $endRev;
|
||||
|
||||
return $this->post("createDiffHTML", $params);
|
||||
}
|
||||
|
||||
// createPad
|
||||
public function createPad($padID, $text = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($text)){
|
||||
$params['text'] = $text;
|
||||
}
|
||||
|
||||
return $this->post("createPad", $params);
|
||||
}
|
||||
|
||||
// createGroupPad
|
||||
public function createGroupPad($groupID, $padName, $text = null){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
$params['padName'] = $padName;
|
||||
if (isset($text)){
|
||||
$params['text'] = $text;
|
||||
}
|
||||
|
||||
return $this->post("createGroupPad", $params);
|
||||
}
|
||||
|
||||
// createAuthor
|
||||
public function createAuthor($name = null){
|
||||
$params = array();
|
||||
|
||||
if (isset($name)){
|
||||
$params['name'] = $name;
|
||||
}
|
||||
|
||||
return $this->post("createAuthor", $params);
|
||||
}
|
||||
|
||||
// createAuthorIfNotExistsFor
|
||||
public function createAuthorIfNotExistsFor($authorMapper, $name = null){
|
||||
$params = array();
|
||||
|
||||
$params['authorMapper'] = $authorMapper;
|
||||
if (isset($name)){
|
||||
$params['name'] = $name;
|
||||
}
|
||||
|
||||
return $this->post("createAuthorIfNotExistsFor", $params);
|
||||
}
|
||||
|
||||
// listPadsOfAuthor
|
||||
public function listPadsOfAuthor($authorID){
|
||||
$params = array();
|
||||
|
||||
$params['authorID'] = $authorID;
|
||||
|
||||
return $this->get("listPadsOfAuthor", $params);
|
||||
}
|
||||
|
||||
// createSession
|
||||
public function createSession($groupID, $authorID, $validUntil){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
$params['authorID'] = $authorID;
|
||||
$params['validUntil'] = $validUntil;
|
||||
|
||||
return $this->post("createSession", $params);
|
||||
}
|
||||
|
||||
// deleteSession
|
||||
public function deleteSession($sessionID){
|
||||
$params = array();
|
||||
|
||||
$params['sessionID'] = $sessionID;
|
||||
|
||||
return $this->post("deleteSession", $params);
|
||||
}
|
||||
|
||||
// getSessionInfo
|
||||
public function getSessionInfo($sessionID){
|
||||
$params = array();
|
||||
|
||||
$params['sessionID'] = $sessionID;
|
||||
|
||||
return $this->get("getSessionInfo", $params);
|
||||
}
|
||||
|
||||
// listSessionsOfGroup
|
||||
public function listSessionsOfGroup($groupID){
|
||||
$params = array();
|
||||
|
||||
$params['groupID'] = $groupID;
|
||||
|
||||
return $this->get("listSessionsOfGroup", $params);
|
||||
}
|
||||
|
||||
// listSessionsOfAuthor
|
||||
public function listSessionsOfAuthor($authorID){
|
||||
$params = array();
|
||||
|
||||
$params['authorID'] = $authorID;
|
||||
|
||||
return $this->get("listSessionsOfAuthor", $params);
|
||||
}
|
||||
|
||||
// getText
|
||||
public function getText($padID, $rev = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($rev)){
|
||||
$params['rev'] = $rev;
|
||||
}
|
||||
|
||||
return $this->get("getText", $params);
|
||||
}
|
||||
|
||||
// setText
|
||||
public function setText($padID, $text){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['text'] = $text;
|
||||
|
||||
return $this->post("setText", $params);
|
||||
}
|
||||
|
||||
// getHTML
|
||||
public function getHTML($padID, $rev = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($rev)){
|
||||
$params['rev'] = $rev;
|
||||
}
|
||||
|
||||
return $this->get("getHTML", $params);
|
||||
}
|
||||
|
||||
// setHTML
|
||||
public function setHTML($padID, $html){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['html'] = $html;
|
||||
|
||||
return $this->post("setHTML", $params);
|
||||
}
|
||||
|
||||
// getAttributePool
|
||||
public function getAttributePool($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getAttributePool", $params);
|
||||
}
|
||||
|
||||
// getRevisionsCount
|
||||
public function getRevisionsCount($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getRevisionsCount", $params);
|
||||
}
|
||||
|
||||
// getSavedRevisionsCount
|
||||
public function getSavedRevisionsCount($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getSavedRevisionsCount", $params);
|
||||
}
|
||||
|
||||
// listSavedRevisions
|
||||
public function listSavedRevisions($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("listSavedRevisions", $params);
|
||||
}
|
||||
|
||||
// saveRevision
|
||||
public function saveRevision($padID, $rev){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['rev'] = $rev;
|
||||
|
||||
return $this->post("saveRevision", $params);
|
||||
}
|
||||
|
||||
// getRevisionChangeset
|
||||
public function getRevisionChangeset($padID, $rev = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($rev)){
|
||||
$params['rev'] = $rev;
|
||||
}
|
||||
|
||||
return $this->get("getRevisionChangeset", $params);
|
||||
}
|
||||
|
||||
// getLastEdited
|
||||
public function getLastEdited($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getLastEdited", $params);
|
||||
}
|
||||
|
||||
// deletePad
|
||||
public function deletePad($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->post("deletePad", $params);
|
||||
}
|
||||
|
||||
// copyPad
|
||||
public function copyPad($sourceID, $destinationID, $force = null){
|
||||
$params = array();
|
||||
|
||||
$params['sourceID'] = $sourceID;
|
||||
$params['destinationID'] = $destinationID;
|
||||
if (isset($force)){
|
||||
$params['force'] = $force;
|
||||
}
|
||||
|
||||
return $this->post("copyPad", $params);
|
||||
}
|
||||
|
||||
// movePad
|
||||
public function movePad($sourceID, $destinationID, $force = null){
|
||||
$params = array();
|
||||
|
||||
$params['sourceID'] = $sourceID;
|
||||
$params['destinationID'] = $destinationID;
|
||||
if (isset($force)){
|
||||
$params['force'] = $force;
|
||||
}
|
||||
|
||||
return $this->post("movePad", $params);
|
||||
}
|
||||
|
||||
// getReadOnlyID
|
||||
public function getReadOnlyID($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getReadOnlyID", $params);
|
||||
}
|
||||
|
||||
// getPadID
|
||||
public function getPadID($roID){
|
||||
$params = array();
|
||||
|
||||
$params['roID'] = $roID;
|
||||
|
||||
return $this->get("getPadID", $params);
|
||||
}
|
||||
|
||||
// setPublicStatus
|
||||
public function setPublicStatus($padID, $publicStatus){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['publicStatus'] = $publicStatus;
|
||||
|
||||
return $this->post("setPublicStatus", $params);
|
||||
}
|
||||
|
||||
// getPublicStatus
|
||||
public function getPublicStatus($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getPublicStatus", $params);
|
||||
}
|
||||
|
||||
// setPassword
|
||||
public function setPassword($padID, $password){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['password'] = $password;
|
||||
|
||||
return $this->post("setPassword", $params);
|
||||
}
|
||||
|
||||
// isPasswordProtected
|
||||
public function isPasswordProtected($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("isPasswordProtected", $params);
|
||||
}
|
||||
|
||||
// listAuthorsOfPad
|
||||
public function listAuthorsOfPad($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("listAuthorsOfPad", $params);
|
||||
}
|
||||
|
||||
// padUsersCount
|
||||
public function padUsersCount($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("padUsersCount", $params);
|
||||
}
|
||||
|
||||
// getAuthorName
|
||||
public function getAuthorName($authorID){
|
||||
$params = array();
|
||||
|
||||
$params['authorID'] = $authorID;
|
||||
|
||||
return $this->get("getAuthorName", $params);
|
||||
}
|
||||
|
||||
// padUsers
|
||||
public function padUsers($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("padUsers", $params);
|
||||
}
|
||||
|
||||
// sendClientsMessage
|
||||
public function sendClientsMessage($padID, $msg){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['msg'] = $msg;
|
||||
|
||||
return $this->post("sendClientsMessage", $params);
|
||||
}
|
||||
|
||||
// listAllGroups
|
||||
public function listAllGroups(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->get("listAllGroups", $params);
|
||||
}
|
||||
|
||||
// checkToken
|
||||
public function checkToken(){
|
||||
$params = array();
|
||||
|
||||
|
||||
return $this->post("checkToken", $params);
|
||||
}
|
||||
|
||||
// getChatHistory
|
||||
public function getChatHistory($padID, $start = null, $end = null){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
if (isset($start)){
|
||||
$params['start'] = $start;
|
||||
}
|
||||
if (isset($end)){
|
||||
$params['end'] = $end;
|
||||
}
|
||||
|
||||
return $this->get("getChatHistory", $params);
|
||||
}
|
||||
|
||||
// getChatHead
|
||||
public function getChatHead($padID){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
|
||||
return $this->get("getChatHead", $params);
|
||||
}
|
||||
|
||||
// restoreRevision
|
||||
public function restoreRevision($padID, $rev){
|
||||
$params = array();
|
||||
|
||||
$params['padID'] = $padID;
|
||||
$params['rev'] = $rev;
|
||||
|
||||
return $this->post("restoreRevision", $params);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<phpunit>
|
||||
<testsuites>
|
||||
<testsuite name="FullStack">
|
||||
<directory>test/FullStack</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
require_once __DIR__.'/../../EtherpadLite/Client.php';
|
||||
|
||||
class AuthorTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
protected function newClient(){
|
||||
return new \EtherpadLite\Client("dcf118bfc58cc69cdf3ae870071f97149924f5f5a9a4a552fd2921b40830aaae");
|
||||
}
|
||||
|
||||
public function testAuthor(){
|
||||
$client = $this->newClient();
|
||||
|
||||
$a = $client->createAuthor('Bob');
|
||||
$this->assertTrue(is_string($a->authorID));
|
||||
|
||||
$n = $client->getAuthorName($a->authorID);
|
||||
$this->assertEquals("Bob", $n);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
require_once __DIR__.'/../../etherpad-lite-client.php';
|
||||
|
||||
class GroupsTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
protected function newClient(){
|
||||
return new \EtherpadLite\Client("dcf118bfc58cc69cdf3ae870071f97149924f5f5a9a4a552fd2921b40830aaae");
|
||||
}
|
||||
|
||||
public function testCreateDeleteGroup(){
|
||||
$client = $this->newClient();
|
||||
|
||||
// Create a group
|
||||
$group = $client->createGroup();
|
||||
$this->assertTrue(is_string($group->groupID));
|
||||
|
||||
// Delete it
|
||||
$r = $client->deleteGroup($group->groupID);
|
||||
$this->assertNull($r);
|
||||
|
||||
// Try to delete it again
|
||||
try {
|
||||
$client->deleteGroup($group->groupID);
|
||||
$this->fail("deleteGroup should fail if group does not exist");
|
||||
} catch (\InvalidArgumentException $e){
|
||||
$this->assertTrue(true); // Just to keep the counter up ;)
|
||||
}
|
||||
}
|
||||
|
||||
public function testListGroups(){
|
||||
$client = $this->newClient();
|
||||
|
||||
// Create a couple of groups
|
||||
$one = $client->createGroup();
|
||||
$two = $client->createGroup();
|
||||
|
||||
$groups = $client->listAllGroups();
|
||||
$this->assertContains($one->groupID, $groups->groupIDs);
|
||||
$this->assertContains($two->groupID, $groups->groupIDs);
|
||||
|
||||
// Clean up
|
||||
$client->deleteGroup($one->groupID);
|
||||
$client->deleteGroup($two->groupID);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
require_once __DIR__.'/../../EtherpadLite/Client.php';
|
||||
|
||||
class PadTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
protected function newClient(){
|
||||
return new \EtherpadLite\Client("dcf118bfc58cc69cdf3ae870071f97149924f5f5a9a4a552fd2921b40830aaae");
|
||||
}
|
||||
|
||||
public function testOneGroupOnePad(){
|
||||
$client = $this->newClient();
|
||||
|
||||
$group = $client->createGroup();
|
||||
$this->assertTrue(is_string($group->groupID));
|
||||
|
||||
$pad = $client->createGroupPad($group->groupID, "PadName", "Default Text");
|
||||
$this->assertTrue(is_string($pad->padID));
|
||||
|
||||
$text = $client->getText($pad->padID);
|
||||
$this->assertEquals("Default Text", trim($text->text));
|
||||
|
||||
$set = $client->setText($pad->padID, "The new text");
|
||||
$this->assertNull($set);
|
||||
|
||||
$text = $client->getText($pad->padID);
|
||||
$this->assertEquals("The new text", trim($text->text));
|
||||
|
||||
$del = $client->deletePad($pad->padID);
|
||||
$this->assertNull($del);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
// Generates an API client using the api-spec.json
|
||||
|
||||
$raw = file_get_contents(__DIR__.'/../api-spec.json');
|
||||
$spec = json_decode($raw);
|
||||
|
||||
// Pre-process the methods to set httpMethod
|
||||
$methods = array();
|
||||
foreach ($spec->methods as $name => $args){
|
||||
|
||||
// Slightly hacky, but should cover all bases
|
||||
$httpMethod = "post";
|
||||
if (hasPrefix($name, "get") ||
|
||||
hasPrefix($name, "list") ||
|
||||
hasPrefix($name, "pad") ||
|
||||
hasPrefix($name, "is")){
|
||||
$httpMethod = "get";
|
||||
}
|
||||
|
||||
$methods[] = array(
|
||||
"name" => $name,
|
||||
"args" => $args,
|
||||
"httpMethod" => $httpMethod,
|
||||
);
|
||||
}
|
||||
|
||||
echo "<?php\n";
|
||||
|
||||
// Render the template
|
||||
render(__DIR__.'/templates/client.php', array(
|
||||
"version" => $spec->version,
|
||||
"methods" => $methods,
|
||||
));
|
||||
|
||||
function render($template, $data){
|
||||
extract($data);
|
||||
include($template);
|
||||
}
|
||||
|
||||
function hasPrefix($candidate, $prefix){
|
||||
if (strpos($candidate, $prefix) === 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
// The following code is automatically generated by ./tools/generate.php
|
||||
// please edit the files in ./tools/templates/ instead of editing this
|
||||
// file directly.
|
||||
|
||||
namespace EtherpadLite;
|
||||
|
||||
class Client {
|
||||
|
||||
const API_VERSION = '<?=$version?>';
|
||||
|
||||
const CODE_OK = 0;
|
||||
const CODE_INVALID_PARAMETERS = 1;
|
||||
const CODE_INTERNAL_ERROR = 2;
|
||||
const CODE_INVALID_FUNCTION = 3;
|
||||
const CODE_INVALID_API_KEY = 4;
|
||||
|
||||
protected $apiKey = "";
|
||||
protected $baseUrl = "http://localhost:9001/api";
|
||||
|
||||
public function __construct($apiKey, $baseUrl = null){
|
||||
if (strlen($apiKey) < 1){
|
||||
throw new \InvalidArgumentException("[{$apiKey}] is not a valid API key");
|
||||
}
|
||||
$this->apiKey = $apiKey;
|
||||
|
||||
if (isset($baseUrl)){
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
if (!filter_var($this->baseUrl, FILTER_VALIDATE_URL)){
|
||||
throw new \InvalidArgumentException("[{$this->baseUrl}] is not a valid URL");
|
||||
}
|
||||
}
|
||||
|
||||
protected function get($function, array $arguments = array()){
|
||||
return $this->call($function, $arguments, 'GET');
|
||||
}
|
||||
|
||||
protected function post($function, array $arguments = array()){
|
||||
return $this->call($function, $arguments, 'POST');
|
||||
}
|
||||
|
||||
protected function convertBools($candidate){
|
||||
if (is_bool($candidate)){
|
||||
return $candidate? "true" : "false";
|
||||
}
|
||||
return $candidate;
|
||||
}
|
||||
|
||||
protected function call($function, array $arguments = array(), $method = 'GET'){
|
||||
$arguments['apikey'] = $this->apiKey;
|
||||
$arguments = array_map(array($this, 'convertBools'), $arguments);
|
||||
$arguments = http_build_query($arguments, '', '&');
|
||||
$url = $this->baseUrl."/".self::API_VERSION."/".$function;
|
||||
if ($method !== 'POST'){
|
||||
$url .= "?".$arguments;
|
||||
}
|
||||
// use curl of it's available
|
||||
if (function_exists('curl_init')){
|
||||
$c = curl_init($url);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_TIMEOUT, 20);
|
||||
if ($method === 'POST'){
|
||||
curl_setopt($c, CURLOPT_POST, true);
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $arguments);
|
||||
}
|
||||
$result = curl_exec($c);
|
||||
curl_close($c);
|
||||
// fallback to plain php
|
||||
} else {
|
||||
$params = array('http' => array('method' => $method, 'ignore_errors' => true, 'header' => 'Content-Type:application/x-www-form-urlencoded'));
|
||||
if ($method === 'POST'){
|
||||
$params['http']['content'] = $arguments;
|
||||
}
|
||||
$context = stream_context_create($params);
|
||||
$fp = fopen($url, 'rb', false, $context);
|
||||
$result = $fp ? stream_get_contents($fp) : null;
|
||||
}
|
||||
|
||||
if(!$result){
|
||||
throw new \UnexpectedValueException("Empty or No Response from the server");
|
||||
}
|
||||
|
||||
$result = json_decode($result);
|
||||
if ($result === null){
|
||||
throw new \UnexpectedValueException("JSON response could not be decoded");
|
||||
}
|
||||
return $this->handleResult($result);
|
||||
}
|
||||
|
||||
protected function handleResult($result){
|
||||
if (!isset($result->code)){
|
||||
throw new \RuntimeException("API response has no code");
|
||||
}
|
||||
if (!isset($result->message)){
|
||||
throw new \RuntimeException("API response has no message");
|
||||
}
|
||||
if (!isset($result->data)){
|
||||
$result->data = null;
|
||||
}
|
||||
|
||||
switch ($result->code){
|
||||
case self::CODE_OK:
|
||||
return $result->data;
|
||||
case self::CODE_INVALID_PARAMETERS:
|
||||
case self::CODE_INVALID_API_KEY:
|
||||
throw new \InvalidArgumentException($result->message);
|
||||
case self::CODE_INTERNAL_ERROR:
|
||||
throw new \RuntimeException($result->message);
|
||||
case self::CODE_INVALID_FUNCTION:
|
||||
throw new \BadFunctionCallException($result->message);
|
||||
default:
|
||||
throw new \RuntimeException("An unexpected error occurred whilst handling the response");
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
foreach($methods as $method){
|
||||
render(__DIR__.'/method.php', $method);
|
||||
}
|
||||
?>
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
$arglist = implode(", ", array_map(function($arg){
|
||||
// Optional arg
|
||||
if ($arg[0] == '['){
|
||||
$arg = trim($arg, "[]");
|
||||
$arg = "{$arg} = null";
|
||||
}
|
||||
return '$'.$arg;
|
||||
}, $args));
|
||||
|
||||
|
||||
echo " // {$name}\n";
|
||||
echo " public function {$name}({$arglist}){\n";
|
||||
echo " \$params = array();\n\n";
|
||||
|
||||
// Optional arg
|
||||
foreach ($args as $arg){
|
||||
if ($arg[0] == '['){
|
||||
$arg = trim($arg, "[]");
|
||||
echo " if (isset(\${$arg})){\n";
|
||||
echo " \$params['{$arg}'] = \${$arg};\n";
|
||||
echo " }\n";
|
||||
} else {
|
||||
echo " \$params['{$arg}'] = \${$arg};\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
echo " return \$this->{$httpMethod}(\"{$name}\", \$params);\n";
|
||||
echo " }\n\n";
|
||||
?>
|
|
@ -1 +0,0 @@
|
|||
dcf118bfc58cc69cdf3ae870071f97149924f5f5a9a4a552fd2921b40830aaae
|
|
@ -1,13 +0,0 @@
|
|||
FROM ubuntu
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y gzip git curl python libssl-dev pkg-config build-essential
|
||||
RUN apt-get install -y nodejs npm
|
||||
RUN ln -s /usr/bin/nodejs /usr/bin/node
|
||||
RUN git clone git://github.com/ether/etherpad-lite.git
|
||||
|
||||
COPY APIKEY.txt /etherpad-lite/
|
||||
|
||||
EXPOSE 9001
|
||||
|
||||
ENTRYPOINT ["/etherpad-lite/bin/run.sh", "--root"]
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
sudo docker run --detach --publish=9001:9001 $1
|
|
@ -1,117 +0,0 @@
|
|||
Ownpad (0.6.16):
|
||||
* **Fix**: Add Nextcloud 21 compatibility.
|
||||
|
||||
Ownpad (0.6.15):
|
||||
* **Fix**: Add Nextcloud 19 compatibility (no changes; thanks @sim6).
|
||||
|
||||
Ownpad (0.6.14):
|
||||
* **Fix**: Add Nextcloud 17 & 18 compatibility (no changes)
|
||||
|
||||
Ownpad (0.6.13):
|
||||
* **Fix**: Add Nextcloud 16 compatibility (no changes)
|
||||
|
||||
Ownpad (0.6.12):
|
||||
* **Fix**: fix regexp used to enable protected pads by removing trailing slash from EPL hostname.
|
||||
|
||||
Ownpad (0.6.11):
|
||||
* **Fix**: fix public pad creation if Etherpad API is not used.
|
||||
|
||||
Ownpad (0.6.10):
|
||||
* **Enhancement**: ownpad should work fine with Nextcloud 15.
|
||||
|
||||
Ownpad (0.6.9):
|
||||
* **Enhancement**: use API to create unprotected pads (thanks @m0urs).
|
||||
* **Fix**: remove deprecated method `getMediumStrengthGenerator` (thanks @rullzer).
|
||||
* **Fix**: only use lower case in pad and calc names to prevent an issue with Ethercalc (thanks @dtygel)
|
||||
* **Fix**: update `README.md` to make more explicit that this app is no more than doing links to Etherpad/Ethercalc.
|
||||
|
||||
Ownpad (0.6.8):
|
||||
* **Fix**: update previous fix to let Ownpad be also compatible with NC 13.
|
||||
|
||||
Ownpad (0.6.7):
|
||||
* **Enhancement**: remove deprecated code calls and let Ownpad be compatible with Nextcloud 14.
|
||||
|
||||
Ownpad (0.6.6):
|
||||
* **Enhancement**: add option to disable non-protected 'public' pads.
|
||||
* **Enhancement**: use proper icons of etherpad-lite and ethercalc.
|
||||
|
||||
Ownpad (0.6.5):
|
||||
* **Bugfix**: fix UI with Nextcloud 13 (thanks @frissdiegurke).
|
||||
* **Enhancement**: enhance settings page.
|
||||
|
||||
Ownpad (0.6.4):
|
||||
* **Bugfix**: fix protected pads (thanks @frissdiegurke).
|
||||
* **Enhancement**: replace ownCloud by Nextcloud.
|
||||
|
||||
Ownpad (0.6.3):
|
||||
* **Enhancement**: move application to the `office` section on Nextcloud app store.
|
||||
* **Bugfix**: update message displayed when pad/calc URL doesn’t match configuration.
|
||||
* **Bugfix**: when applying migration, don’t forget to check version…
|
||||
|
||||
Ownpad (0.6.2):
|
||||
* **Enhancement**: make app compatible with Nextcloud 13 (and drop ownCloud support).
|
||||
* **Enhancement**: finish code refactoring (`app.php` moved to `Application` class).
|
||||
* **Bugfix**: don’t forget to load JavaScript code on the settings page.
|
||||
|
||||
Ownpad (0.6.1):
|
||||
* **Enhancement**: move internal logic to a new OwnpadService class.
|
||||
* **Bugfix**: fix regression introduced in previous version (bb3f3199c44d35b21a45d1ae6dd5524853f401cf).
|
||||
|
||||
Ownpad (0.6.0):
|
||||
* **Enhancement**: support for Etherpad API (experimental, incomplete and probably not totally secure) which allows to create private pads.
|
||||
* **Enhancement**: refactor app to use AppFramework.
|
||||
* **Bugfix**: remove deprecated code (thanks @MorrisJobke!).
|
||||
|
||||
Ownpad (0.5.10)
|
||||
* **Bugfix**: fix HTML code in template settings (thanks to KTim21).
|
||||
* **Bugfix**: change Etherpad/Ethercalc instances hints on the configuration page.
|
||||
* **Bugfix**: fix “multisheet support” for Ethercalc.
|
||||
* **Bugfix**: fix Ethercalc URL validation.
|
||||
* **Bugfix**: fix HTML code in the `noviewer.php` template.
|
||||
|
||||
Ownpad (0.5.9)
|
||||
* **Enhancement**: check for valid URL in pads/calcs to prevent bad redirections (thanks to Stephan Wiefling).
|
||||
* **Enhancement**: make Ownpad compatible with Nextcloud 12.
|
||||
* **Enhancement**: update documentation.
|
||||
|
||||
Ownpad (0.5.8)
|
||||
* **Enhancement**: enable multisheet support for new Ethercalc.
|
||||
* **Enhancement**: update Content-Security-Policy rules.
|
||||
|
||||
Ownpad (0.5.6)
|
||||
* **Enhancement**: make Ownpad compatible with Nextcloud 11.
|
||||
* **Bugfix**: don’t call for Ownpad configuration on public pages (fixes page reload on public pages)
|
||||
|
||||
Ownpad (0.5.4)
|
||||
* **Bugfix**: fix info.xml format for Nextcloud appstore.
|
||||
|
||||
Ownpad (0.5.3)
|
||||
* **Enhancement**: add icon for Etherpad in the “+” menu.
|
||||
* **Enhancement**: some minor code enhacements.
|
||||
* **Bugfix**: fix upgrade code (issue was introduced in 6560a6adf1b5027dfb70c0df6eff527f4d2304f2).
|
||||
|
||||
Ownpad (0.5.2)
|
||||
* **Enhancement**: don’t display pad/calc if no URL is configured for Ownpad.
|
||||
* **Enhancement**: some minor changes (typo, etc.)
|
||||
* **Enhancement**: minor changes to the configuration page.
|
||||
|
||||
Ownpad (0.5.1)
|
||||
* **Bugfix**: disable Ownpad’s mimetypes registration at application level, to prevent breaking all other mimetypes. This requires to manually add mimetypes to ownCloud’s configuration (see README.md).
|
||||
|
||||
Ownpad (0.5.0)
|
||||
* **Bugfix**: fix portability to ownCloud 9.
|
||||
|
||||
Ownpad (0.4.0)
|
||||
* **Enhancement**: port code to ownCloud 9
|
||||
|
||||
Ownpad (0.3.0)
|
||||
**Bugfix**: Add Content-Security-Policy rules in order to allow the pad/calc iframe to be opened (required by ownCloud 8.1).
|
||||
**Bugfix**: Fix the way URL are encoded to make Etherpad happy.
|
||||
**Bugfix**: Fix the pad’s viewer size
|
||||
|
||||
Ownpad (0.2.0)
|
||||
* **Enhancement**: New pads/calcs are now handled by a specific AJAX script (`ajax/newpad.php`) that manage the file content.
|
||||
* **Enhancement**: Autosave items in configuration page, and add a confirmation message (inspired by the `news` app).
|
||||
|
||||
Ownpad (0.1.0)
|
||||
* First release
|
|
@ -1,661 +0,0 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
|
@ -1,90 +0,0 @@
|
|||
# Ownpad — Etherpad and Ethercalc _links_ in Nextcloud
|
||||
|
||||
Ownpad is a Nextcloud application that allows to create and open
|
||||
Etherpad and Ethercalc documents. This application requires to have
|
||||
access to an instance of Etherpad and/or Ethercalc to work properly.
|
||||
|
||||
Note that the documents are only stored with your Etherpad/Ethercalc
|
||||
service provider; no copy is kept on Nextcloud. As documents are
|
||||
created this way Nextcloud is not responsible for the documents
|
||||
security, e.g. anyone with access to the Etherpad/Ethercalc service
|
||||
can access your documents.
|
||||
|
||||
## Configuration
|
||||
|
||||
In order to make Ownpad work, go to the configuration panel (Settings /
|
||||
Admininstration / Additional Settings) and fill in the necessary data
|
||||
within the “Ownpad (collaborative documents)” section.
|
||||
|
||||
**Set a Etherpad Host:**
|
||||
To be able to process the document, you must configure a Host. [Find more public providers at the Etherpad-Lite wiki](https://github.com/ether/etherpad-lite/wiki/Sites-that-run-Etherpad-Lite)
|
||||
|
||||
*Example:*
|
||||
* Etherpad Host https://etherpad.wikimedia.org/
|
||||
* Ethercalc Host https://ethercalc.org/
|
||||
|
||||
Note that most browsers will only display the content if both Nextcloud and Etherpad/Ethercalc are served via HTTPS.
|
||||
|
||||
Afterwards, the “pad” and/or “calc” items will be available in the “+”
|
||||
menu from the “File” app.
|
||||
|
||||
## Mimetype detection
|
||||
|
||||
Unfortunately, apps can’t declare new mimetypes on the fly. To make
|
||||
Ownpad work properly, you need to add two new mimetypes in the
|
||||
`mimetypemapping.json` file (at Nextcloud level).
|
||||
|
||||
To proceed, just copy `/resources/config/mimetypemapping.dist.json` to
|
||||
`/config/mimetypemapping.json` (in the `config/` folder at Nextcloud’s
|
||||
root directory; the file should be stored next to the `config.php`
|
||||
file).
|
||||
|
||||
For the [snap-distribution of Nextcloud](https://github.com/nextcloud/nextcloud-snap) the template file can be found under `/snap/nextcloud/current/htdocs/resources/config/mimetypemapping.dist.json` and the active config-folder by default is `/var/snap/nextcloud/current/nextcloud/config/`.
|
||||
|
||||
Afterwards add the two following lines just after the “_comment”
|
||||
lines.
|
||||
|
||||
"pad": ["application/x-ownpad"],
|
||||
"calc": ["application/x-ownpad"],
|
||||
|
||||
If all other mimetypes are not working properly, just run the
|
||||
following command:
|
||||
|
||||
sudo -u www-data php occ files:scan --all
|
||||
|
||||
For the snap-distribution that is
|
||||
|
||||
sudo nextcloud.occ files:scan --all
|
||||
|
||||
## Create access restricted pads
|
||||
|
||||
Ownpad supports communication with the Etherpad API for access
|
||||
restriction (so called *protected pads*). This support is considered
|
||||
**experimental** due to work in progress; some features are still
|
||||
missing. See the [TODO.md](TODO.md) for details.
|
||||
|
||||
Protected pads need to be accessed via Nextcloud in order to gain access
|
||||
privileges.
|
||||
|
||||
In order for this to work, you’ll need to enter your Etherpad API key
|
||||
within the Ownpad settings. You can find your API key in the
|
||||
`APIKEY.txt` file of your Etherpad instance.
|
||||
|
||||
In addition you’ll need to host your Etherpad and Nextcloud instances
|
||||
under the same domain. For example, you can host your Etherpad in
|
||||
`pad.example.org` and your Nextcloud in `cloud.example.org`. For this
|
||||
example, you’ll have to set the cookie domain to `example.org` within
|
||||
the Ownpad settings.
|
||||
|
||||
If you want to create *truly* private pads, you have to dedicate an
|
||||
Etherpad instance for Nextcloud **running both with HTTPS**. You will then configure Etherpad to
|
||||
restrict pad access via sessions and pad creation via the API.
|
||||
For this, you have to adjust your Etherpad configuration file
|
||||
(`settings.json`) as following:
|
||||
|
||||
"requireSession" : true,
|
||||
"editOnly" : true,
|
||||
|
||||
## License
|
||||
|
||||
The code is licensed under the AGPLv3 which can be found as the file [COPYING](COPYING) in the source code repository.
|
|
@ -1,27 +0,0 @@
|
|||
# Todo list
|
||||
|
||||
- [x] Add basic support for Etherpad API (create & open pads).
|
||||
- [ ] Check rights before opening the file (mainly, respect rights if
|
||||
share doesn’t allow modifications).
|
||||
- [ ] Make configuration more user-friendly (maybe, automatically find
|
||||
the most correct cookie domain to use). Maybe also add a new
|
||||
configuration item to mark that Etherpad API is usable (after
|
||||
test).
|
||||
- [ ] Try to find a way to work-around the cookie issue (that may
|
||||
require to develop a tiny plugin for Etherpad that would allow
|
||||
to set the cookie for us). This
|
||||
[plugin](https://www.npmjs.com/package/ep_auth_session) exists,
|
||||
we could add an option to support it.
|
||||
- [ ] Handle errors and exceptions.
|
||||
- [ ] Handle session timeouts (we ask for 3600 seconds session to
|
||||
Etherpad, but we are using a session cookie).
|
||||
- [ ] Handle ACL revocation (add some kind of hook on ACL changes, and
|
||||
re-validate / check all sessions for that specific pad(s))
|
||||
- [ ] Manage multiple ownCloud instances for Etherpad (when calling
|
||||
`createAuthorIfNotExistsFor`).
|
||||
- [ ] Manage multiple sessions for Etherpad (you can add multiple
|
||||
sessions to the `sessionID` cookie by separating them by
|
||||
commas).
|
||||
- [ ] Cleanup `sessionID` cookie after logout (a bit tricky, requires
|
||||
to save the current `sessionID` somewhere and remove it after
|
||||
user logs out).
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\AppInfo;
|
||||
|
||||
require_once __DIR__ . '/../3rdparty/autoload.php';
|
||||
|
||||
$app = new Application();
|
||||
$app->registerHooks();
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
|
||||
<id>ownpad</id>
|
||||
<name>Ownpad</name>
|
||||
<summary>
|
||||
Create and open Etherpad and Ethercalc documents.
|
||||
</summary>
|
||||
<description>
|
||||
Ownpad is a Nextcloud application that allows to create and open
|
||||
Etherpad and Ethercalc documents.
|
||||
|
||||
This application requires to have access to an instance of
|
||||
Etherpad and/or Ethercalc to work properly.
|
||||
</description>
|
||||
<version>0.6.16</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="olivier.tetard@miskin.fr">Olivier Tétard</author>
|
||||
<documentation>
|
||||
<user>https://github.com/otetard/ownpad/blob/master/README.md#mimetype-detection</user>
|
||||
</documentation>
|
||||
<category>office</category>
|
||||
<bugs>https://github.com/otetard/ownpad/issues</bugs>
|
||||
<repository>https://github.com/otetard/ownpad</repository>
|
||||
<screenshot small-thumbnail="https://raw.githubusercontent.com/otetard/ownpad/master/screenshots/1-small.png">https://raw.githubusercontent.com/otetard/ownpad/master/screenshots/1.png</screenshot>
|
||||
<dependencies>
|
||||
<nextcloud min-version="19" max-version="21" />
|
||||
</dependencies>
|
||||
<repair-steps>
|
||||
<post-migration>
|
||||
<step>OCA\Ownpad\Migration\MigrateSettings</step>
|
||||
<step>OCA\Ownpad\Migration\ConfigPublicEnable</step>
|
||||
</post-migration>
|
||||
</repair-steps>
|
||||
<settings>
|
||||
<admin>OCA\Ownpad\Settings\AdminSettings</admin>
|
||||
</settings>
|
||||
<ocsid>174679</ocsid>
|
||||
</info>
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Appinfo;
|
||||
|
||||
/** @var $this \OC\Route\Router */
|
||||
|
||||
$this->create('ownpad_newpad', 'ajax/newpad.php')->actionInclude('ownpad/ajax/newpad.php');
|
||||
|
||||
return ['routes' => [
|
||||
['name' => 'display#showPad', 'url' => '/', 'verb' => 'GET'],
|
||||
['name' => 'ajax#getconfig', 'url' => '/ajax/v1.0/getconfig', 'verb' => 'GET'],
|
||||
['name' => 'ajax#newpad', 'url' => '/ajax/v1.0/newpad', 'verb' => 'POST'],
|
||||
]];
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
#ownpad_bar {
|
||||
background: #333;
|
||||
color: #999;
|
||||
min-height: 25px;
|
||||
padding: 6px 6px 6px 10px;
|
||||
}
|
||||
#ownpad_bar span {
|
||||
opacity: 0;
|
||||
transition: all 1s ease;
|
||||
-o-transition: all 1s ease;
|
||||
-moz-transition: all 1s ease;
|
||||
-webkit-transition: all 1s ease;
|
||||
}
|
||||
#ownpad_bar:hover span {
|
||||
opacity: 1;
|
||||
}
|
||||
#ownpad_bar a,#ownpad_bar strong {
|
||||
color: #CCC;
|
||||
}
|
||||
#ownpad_close {
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
height: 20px;
|
||||
background: #900;
|
||||
color: #F5F5F5;
|
||||
border-radius: 3px;
|
||||
border: #C00 1px solid;
|
||||
font-weight: 900;
|
||||
float: right;
|
||||
}
|
||||
#ownpad_close:hover {
|
||||
background: #C00;
|
||||
color: #FFF;
|
||||
border: #F00 1px solid;
|
||||
}
|
||||
|
||||
.icon-filetype-etherpad {
|
||||
background-image: url("../img/etherpad-lite.ico");
|
||||
background-size: 16px;
|
||||
}
|
||||
.icon-filetype-ethercalc {
|
||||
background-image: url("../img/ethercalc.ico");
|
||||
background-size: 16px;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
#ownpad-saved-message {
|
||||
margin: 15px 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#ownpad .indent {
|
||||
padding-left: 28px;
|
||||
}
|
||||
|
||||
#ownpad .double-indent {
|
||||
padding-left: 56px;
|
||||
}
|
||||
|
||||
input#ownpad_etherpad_host,
|
||||
input#ownpad_ethercalc_host,
|
||||
input#ownpad_etherpad_apikey,
|
||||
input#ownpad_etherpad_cookie_domain
|
||||
{
|
||||
width: 300px;
|
||||
}
|
|
@ -1,911 +0,0 @@
|
|||
Files: ethercalc.ico
|
||||
|
||||
SOCIALCALC LICENSE.txt FILE:
|
||||
|
||||
=========================================
|
||||
ABOUT THIS FILE
|
||||
=========================================
|
||||
|
||||
This file includes copies of the Common Public Attribution License (CPAL) and
|
||||
the Artistic License 2.0.
|
||||
|
||||
This product consists of components licensed under different licenses.
|
||||
Check the contents of each file for a statement of the license for that file.
|
||||
Files without license information are licensed under the Artistic License 2.0.
|
||||
|
||||
======================================================
|
||||
COMMON PUBLIC ATTRIBUTION LICENSE VERSION 1.0 (CPAL)
|
||||
======================================================
|
||||
|
||||
Common Public Attribution License Version 1.0 (CPAL)
|
||||
|
||||
1. "Definitions"
|
||||
|
||||
1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code
|
||||
available to a third party.
|
||||
|
||||
1.1 "Contributor" means each entity that creates or contributes to the creation
|
||||
of Modifications.
|
||||
|
||||
1.2 "Contributor Version" means the combination of the Original Code, prior
|
||||
Modifications used by a Contributor, and the Modifications made by that particular
|
||||
Contributor.
|
||||
|
||||
1.3 "Covered Code" means the Original Code or Modifications or the combination of
|
||||
the Original Code and Modifications, in each case including portions thereof.
|
||||
|
||||
1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in
|
||||
the software development community for the electronic transfer of data.
|
||||
|
||||
1.5 "Executable" means Covered Code in any form other than Source Code.
|
||||
|
||||
1.6 "Initial Developer" means the individual or entity identified as the Initial
|
||||
Developer in the Source Code notice required by Exhibit A.
|
||||
|
||||
1.7 "Larger Work" means a work which combines Covered Code or portions thereof with
|
||||
code not governed by the terms of this License.
|
||||
|
||||
1.8 "License" means this document.
|
||||
|
||||
1.8.1 "Licensable" means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently acquired, any and all of
|
||||
the rights conveyed herein.
|
||||
|
||||
1.9 "Modifications" means any addition to or deletion from the substance or structure
|
||||
of either the Original Code or any previous Modifications. When Covered Code is
|
||||
released as a series of files, a Modification is:
|
||||
|
||||
A. Any addition to or deletion from the contents of a file containing Original Code
|
||||
or previous Modifications.
|
||||
|
||||
B. Any new file that contains any part of the Original Code or previous Modifications.
|
||||
|
||||
1.10 "Original Code" means Source Code of computer software code which is described in
|
||||
the Source Code notice required by Exhibit A as Original Code, and which, at the time
|
||||
of its release under this License is not already Covered Code governed by this License.
|
||||
|
||||
1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired,
|
||||
including without limitation, method, process, and apparatus claims, in any patent
|
||||
Licensable by grantor.
|
||||
|
||||
1.11 "Source Code" means the preferred form of the Covered Code for making modifications
|
||||
to it, including all modules it contains, plus any associated interface definition files,
|
||||
scripts used to control compilation and installation of an Executable, or source code
|
||||
differential comparisons against either the Original Code or another well known,
|
||||
available Covered Code of the Contributor’s choice. The Source Code can be in a compressed
|
||||
or archival form, provided the appropriate decompression or de-archiving software is
|
||||
widely available for no charge.
|
||||
|
||||
1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and
|
||||
complying with all of the terms of, this License or a future version of this License
|
||||
issued under Section 6.1. For legal entities, "You" includes any entity which controls,
|
||||
is controlled by, or is under common control with You. For purposes of this definition,
|
||||
"control" means (a) the power, direct or indirect, to cause the direction or management
|
||||
of such entity, whether by contract or otherwise, or (b) ownership of more than fifty
|
||||
percent (50%) of the outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
2. Source Code License.
|
||||
|
||||
2.1 The Initial Developer Grant.
|
||||
|
||||
The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive
|
||||
license, subject to third party intellectual property claims:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark) Licensable by
|
||||
Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute
|
||||
the Original Code (or portions thereof) with or without Modifications, and/or as part
|
||||
of a Larger Work; and
|
||||
|
||||
(b) under Patents Claims infringed by the making, using or selling of Original Code, to
|
||||
make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of
|
||||
the Original Code (or portions thereof).
|
||||
|
||||
(c) the licenses granted in this Section 2.1(a) and (b) are effective on the date
|
||||
Initial Developer first distributes Original Code under the terms of this License.
|
||||
|
||||
(d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code
|
||||
that You delete from the Original Code; 2) separate from the Original Code; or 3) for
|
||||
infringements caused by: i) the modification of the Original Code or ii) the combination
|
||||
of the Original Code with other software or devices.
|
||||
|
||||
2.2 Contributor Grant.
|
||||
|
||||
Subject to third party intellectual property claims, each Contributor hereby grants You
|
||||
a world-wide, royalty-free, non-exclusive license
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark) Licensable by
|
||||
Contributor, to use, reproduce, modify, display, perform, sublicense and distribute
|
||||
the Modifications created by such Contributor (or portions thereof) either on an
|
||||
unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger
|
||||
Work; and
|
||||
|
||||
(b) under Patent Claims infringed by the making, using, or selling of Modifications
|
||||
made by that Contributor either alone and/or in combination with its Contributor
|
||||
Version (or portions of such combination), to make, use, sell, offer for sale, have
|
||||
made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or
|
||||
portions thereof); and 2) the combination of Modifications made by that Contributor
|
||||
with its Contributor Version (or portions of such combination).
|
||||
|
||||
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date
|
||||
Contributor first makes Commercial Use of the Covered Code.
|
||||
|
||||
(d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code
|
||||
that Contributor has deleted from the Contributor Version; 2) separate from the
|
||||
Contributor Version; 3) for infringements caused by: i) third party modifications of
|
||||
Contributor Version or ii) the combination of Modifications made by that Contributor
|
||||
with other software (except as part of the Contributor Version) or other devices; or
|
||||
4) under Patent Claims infringed by Covered Code in the absence of Modifications made
|
||||
by that Contributor.
|
||||
|
||||
3. Distribution Obligations.
|
||||
|
||||
3.1 Application of License.
|
||||
|
||||
The Modifications which You create or to which You contribute are governed by the terms
|
||||
of this License, including without limitation Section 2.2. The Source Code version of
|
||||
Covered Code may be distributed only under the terms of this License or a future version
|
||||
of this License released under Section 6.1, and You must include a copy of this License
|
||||
with every copy of the Source Code You distribute. You may not offer or impose any terms
|
||||
on any Source Code version that alters or restricts the applicable version of this License
|
||||
or the recipients’ rights hereunder. However, You may include an additional document
|
||||
offering the additional rights described in Section 3.5.
|
||||
|
||||
3.2 Availability of Source Code.
|
||||
|
||||
Any Modification which You create or to which You contribute must be made available in
|
||||
Source Code form under the terms of this License either on the same media as an Executable
|
||||
version or via an accepted Electronic Distribution Mechanism to anyone to whom you made
|
||||
an Executable version available; and if made available via Electronic Distribution
|
||||
Mechanism, must remain available for at least twelve (12) months after the date it
|
||||
initially became available, or at least six (6) months after a subsequent version of that
|
||||
particular Modification has been made available to such recipients. You are responsible
|
||||
for ensuring that the Source Code version remains available even if the Electronic
|
||||
Distribution Mechanism is maintained by a third party.
|
||||
|
||||
3.3 Description of Modifications.
|
||||
|
||||
You must cause all Covered Code to which You contribute to contain a file documenting the
|
||||
changes You made to create that Covered Code and the date of any change. You must include
|
||||
a prominent statement that the Modification is derived, directly or indirectly, from
|
||||
Original Code provided by the Initial Developer and including the name of the Initial
|
||||
Developer in (a) the Source Code, and (b) in any notice in an Executable version or
|
||||
related documentation in which You describe the origin or ownership of the Covered Code.
|
||||
|
||||
3.4 Intellectual Property Matters
|
||||
|
||||
(a) Third Party Claims.
|
||||
|
||||
If Contributor has knowledge that a license under a third party’s intellectual property
|
||||
rights is required to exercise the rights granted by such Contributor under Sections 2.1
|
||||
or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL"
|
||||
which describes the claim and the party making the claim in sufficient detail that a
|
||||
recipient will know whom to contact. If Contributor obtains such knowledge after the
|
||||
Modification is made available as described in Section 3.2, Contributor shall promptly
|
||||
modify the LEGAL file in all copies Contributor makes available thereafter and shall take
|
||||
other steps (such as notifying appropriate mailing lists or newsgroups) reasonably
|
||||
calculated to inform those who received the Covered Code that new knowledge has been obtained.
|
||||
|
||||
(b) Contributor APIs.
|
||||
|
||||
If Contributor’s Modifications include an application programming interface and Contributor
|
||||
has knowledge of patent licenses which are reasonably necessary to implement that API,
|
||||
Contributor must also include this information in the LEGAL file.
|
||||
|
||||
(c) Representations.
|
||||
|
||||
Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor
|
||||
believes that Contributor’s Modifications are Contributor’s original creation(s) and/or
|
||||
Contributor has sufficient rights to grant the rights conveyed by this License.
|
||||
|
||||
3.5 Required Notices.
|
||||
|
||||
You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not
|
||||
possible to put such notice in a particular Source Code file due to its structure, then
|
||||
You must include such notice in a location (such as a relevant directory) where a user
|
||||
would be likely to look for such a notice. If You created one or more Modification(s)
|
||||
You may add your name as a Contributor to the notice described in Exhibit A. You must
|
||||
also duplicate this License in any documentation for the Source Code where You describe
|
||||
recipients’ rights or ownership rights relating to Covered Code. You may choose to offer,
|
||||
and to charge a fee for, warranty, support, indemnity or liability obligations to one or
|
||||
more recipients of Covered Code. However, You may do so only on Your own behalf, and not
|
||||
on behalf of the Initial Developer or any Contributor. You must make it absolutely clear
|
||||
than any such warranty, support, indemnity or liability obligation is offered by You alone,
|
||||
and You hereby agree to indemnify the Initial Developer and every Contributor for any
|
||||
liability incurred by the Initial Developer or such Contributor as a result of warranty,
|
||||
support, indemnity or liability terms You offer.
|
||||
|
||||
3.6 Distribution of Executable Versions.
|
||||
|
||||
You may distribute Covered Code in Executable form only if the requirements of Section
|
||||
3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the
|
||||
Source Code version of the Covered Code is available under the terms of this License,
|
||||
including a description of how and where You have fulfilled the obligations of Section
|
||||
3.2. The notice must be conspicuously included in any notice in an Executable version,
|
||||
related documentation or collateral in which You describe recipients’ rights relating to
|
||||
the Covered Code. You may distribute the Executable version of Covered Code or ownership
|
||||
rights under a license of Your choice, which may contain terms different from this License,
|
||||
provided that You are in compliance with the terms of this License and that the license for
|
||||
the Executable version does not attempt to limit or alter the recipient’s rights in the
|
||||
Source Code version from the rights set forth in this License. If You distribute the
|
||||
Executable version under a different license You must make it absolutely clear that any
|
||||
terms which differ from this License are offered by You alone, not by the Initial Developer,
|
||||
Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer,
|
||||
Original Developer and every Contributor for any liability incurred by the Initial Developer,
|
||||
Original Developer or such Contributor as a result of any such terms You offer.
|
||||
|
||||
3.7 Larger Works.
|
||||
|
||||
You may create a Larger Work by combining Covered Code with other code not governed by the
|
||||
terms of this License and distribute the Larger Work as a single product. In such a case, You
|
||||
must make sure the requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation.
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this License with respect to
|
||||
some or all of the Covered Code due to statute, judicial order, or regulation then You must:
|
||||
(a) comply with the terms of this License to the maximum extent possible; and (b) describe the
|
||||
limitations and the code they affect. Such description must be included in the LEGAL file
|
||||
described in Section 3.4 and must be included with all distributions of the Source Code.
|
||||
Except to the extent prohibited by statute or regulation, such description must be
|
||||
sufficiently detailed for a recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Application of this License.
|
||||
|
||||
This License applies to code to which the Initial Developer has attached the notice in Exhibit
|
||||
A and to related Covered Code.
|
||||
|
||||
6. Versions of the License.
|
||||
|
||||
6.1 New Versions.
|
||||
|
||||
Socialtext, Inc. ("Socialtext") may publish revised and/or new versions of the License from
|
||||
time to time. Each version will be given a distinguishing version number.
|
||||
|
||||
6.2 Effect of New Versions.
|
||||
|
||||
Once Covered Code has been published under a particular version of the License, You may always
|
||||
continue to use it under the terms of that version. You may also choose to use such Covered
|
||||
Code under the terms of any subsequent version of the License published by Socialtext. No one
|
||||
other than Socialtext has the right to modify the terms applicable to Covered Code created
|
||||
under this License.
|
||||
|
||||
6.3 Derivative Works.
|
||||
|
||||
If You create or use a modified version of this License (which you may only do in order to
|
||||
apply it to code which is not already Covered Code governed by this License), You must (a)
|
||||
rename Your license so that the phrases "Socialtext", "CPAL" or any confusingly similar phrase
|
||||
do not appear in your license (except to note that your license differs from this License) and
|
||||
(b) otherwise make it clear that Your version of the license contains terms which differ from
|
||||
the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or
|
||||
Contributor in the notice described in Exhibit A shall not of themselves be deemed to be
|
||||
modifications of this License.)
|
||||
|
||||
7. DISCLAIMER OF WARRANTY.
|
||||
|
||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND,
|
||||
EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS
|
||||
FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK
|
||||
AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE
|
||||
DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER
|
||||
CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS
|
||||
AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
8. TERMINATION.
|
||||
|
||||
8.1 This License and the rights granted hereunder will terminate automatically if You fail to
|
||||
comply with terms herein and fail to cure such breach within 30 days of becoming aware of the
|
||||
breach. All sublicenses to the Covered Code which are properly granted shall survive any
|
||||
termination of this License. Provisions which, by their nature, must remain in effect beyond
|
||||
the termination of this License shall survive.
|
||||
|
||||
8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory
|
||||
judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial
|
||||
Developer, Original Developer or Contributor against whom You file such action is referred to
|
||||
as "Participant") alleging that:
|
||||
|
||||
(a) such Participant’s Contributor Version directly or indirectly infringes any patent, then
|
||||
any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this
|
||||
License shall, upon 60 days notice from Participant terminate prospectively, unless if within
|
||||
60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually
|
||||
agreeable reasonable royalty for Your past and future use of Modifications made by such
|
||||
Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version
|
||||
against such Participant. If within 60 days of notice, a reasonable royalty and payment
|
||||
arrangement are not mutually agreed upon in writing by the parties or the litigation claim is
|
||||
not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2
|
||||
automatically terminate at the expiration of the 60 day notice period specified above.
|
||||
|
||||
(b) any software, hardware, or device, other than such Participant’s Contributor Version,
|
||||
directly or indirectly infringes any patent, then any rights granted to You by such Participant
|
||||
under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used,
|
||||
sold, distributed, or had made, Modifications made by that Participant.
|
||||
|
||||
8.3 If You assert a patent infringement claim against Participant alleging that such
|
||||
Participant’s Contributor Version directly or indirectly infringes any patent where such claim
|
||||
is resolved (such as by license or settlement) prior to the initiation of patent infringement
|
||||
litigation, then the reasonable value of the licenses granted by such Participant under Sections
|
||||
2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or
|
||||
license.
|
||||
|
||||
8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements
|
||||
(excluding distributors and resellers) which have been validly granted by You or any distributor
|
||||
hereunder prior to termination shall survive termination.
|
||||
|
||||
9. LIMITATION OF LIABILITY.
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT,
|
||||
OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR
|
||||
ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON
|
||||
FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING,
|
||||
WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION,
|
||||
OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR
|
||||
DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY’S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
10. U.S. GOVERNMENT END USERS.
|
||||
|
||||
The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995),
|
||||
consisting of "commercial computer software" and "commercial computer software documentation," as
|
||||
such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48
|
||||
C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered
|
||||
Code with only those rights set forth herein.
|
||||
|
||||
11. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject matter hereof. If any provision
|
||||
of this License is held to be unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. This License shall be governed by California law provisions
|
||||
(except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law
|
||||
provisions. With respect to disputes in which at least one party is a citizen of, or an entity
|
||||
chartered or registered to do business in the United States of America, any litigation relating to
|
||||
this License shall be subject to the jurisdiction of the Federal Courts of the Northern District
|
||||
of California, with venue lying in Santa Clara County, California, with the losing party
|
||||
responsible for costs, including without limitation, court costs and reasonable attorneys’ fees
|
||||
and expenses. The application of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a
|
||||
contract shall be construed against the drafter shall not apply to this License.
|
||||
|
||||
12. RESPONSIBILITY FOR CLAIMS.
|
||||
|
||||
As between Initial Developer, Original Developer and the Contributors, each party is responsible
|
||||
for claims and damages arising, directly or indirectly, out of its utilization of rights under
|
||||
this License and You agree to work with Initial Developer, Original Developer and Contributors to
|
||||
distribute such responsibility on an equitable basis. Nothing herein is intended or shall be
|
||||
deemed to constitute any admission of liability.
|
||||
|
||||
13. MULTIPLE-LICENSED CODE.
|
||||
|
||||
Initial Developer may designate portions of the Covered Code as Multiple-Licensed.
|
||||
Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered
|
||||
Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial
|
||||
Developer in the file described in Exhibit A.
|
||||
|
||||
14. ADDITIONAL TERM: ATTRIBUTION
|
||||
|
||||
(a) As a modest attribution to the organizer of the development of the Original Code ("Original
|
||||
Developer"), in the hope that its promotional value may help justify the time, money and effort
|
||||
invested in writing the Original Code, the Original Developer may include in Exhibit B
|
||||
("Attribution Information") a requirement that each time an Executable and Source Code or a Larger
|
||||
Work is launched or initially run (which includes initiating a session), a prominent display of
|
||||
the Original Developer’s Attribution Information (as defined below) must occur on the graphic user
|
||||
interface employed by the end user to access such Covered Code (which may include display on a
|
||||
splash screen), if any. The size of the graphic image should be consistent with the size of the
|
||||
other elements of the Attribution Information. If the access by the end user to the Executable and
|
||||
Source Code does not create a graphic user interface for access to the Covered Code, this
|
||||
obligation shall not apply. If the Original Code displays such Attribution Information in a
|
||||
particular form (such as in the form of a splash screen, notice at login, an "about" display, or
|
||||
dedicated attribution area on user interface screens), continued use of such form for that
|
||||
Attribution Information is one way of meeting this requirement for notice.
|
||||
|
||||
(b) Attribution information may only include a copyright notice, a brief phrase, graphic image and
|
||||
a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For
|
||||
these purposes, prominent shall mean display for sufficient duration to give reasonable notice to
|
||||
the user of the identity of the Original Developer and that if You include Attribution Information
|
||||
or similar information for other parties, You must ensure that the Attribution Information for the
|
||||
Original Developer shall be no less prominent than such Attribution Information or similar
|
||||
information for the other party. For greater certainty, the Original Developer may choose to
|
||||
specify in Exhibit B below that the above attribution requirement only applies to an Executable
|
||||
and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The
|
||||
intent is to provide for reasonably modest attribution, therefore the Original Developer cannot
|
||||
require that You display, at any time, more than the following information as Attribution
|
||||
Information: (a) a copyright notice including the name of the Original Developer; (b) a word or
|
||||
one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and
|
||||
(d) a URL (collectively, the "Attribution Limits").
|
||||
|
||||
(c) If Exhibit B does not include any Attribution Information, then there are no requirements for
|
||||
You to display any Attribution Information of the Original Developer.
|
||||
|
||||
(d) You acknowledge that all trademarks, service marks and/or trade names contained within the
|
||||
Attribution Information distributed with the Covered Code are the exclusive property of their
|
||||
owners and may only be used with the permission of their owners, or under circumstances otherwise
|
||||
permitted by law or as expressly set out in this License.
|
||||
|
||||
15. ADDITIONAL TERM: NETWORK USE.
|
||||
The term "External Deployment" means the use, distribution, or communication of the Original Code
|
||||
or Modifications in any way such that the Original Code or Modifications may be used by anyone
|
||||
other than You, whether those works are distributed or communicated to those persons or made
|
||||
available as an application intended for use over a network. As an express condition for the grants
|
||||
of license hereunder, You must treat any External Deployment by You of the Original Code or
|
||||
Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2.
|
||||
|
||||
EXHIBIT A. Common Public Attribution License Version 1.0.
|
||||
|
||||
"The contents of this file are subject to the Common Public Attribution License Version 1.0 (the
|
||||
"License"); you may not use this file except in compliance with the License. You may obtain a copy
|
||||
of the License at _____________. The License is based on the Mozilla Public License Version 1.1 but
|
||||
Sections 14 and 15 have been added to cover use of software over a computer network and provide for
|
||||
limited attribution for the Original Developer. In addition, Exhibit A has been modified to be
|
||||
consistent with Exhibit B.
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
KIND, either express or implied. See the License for the specific language governing rights and
|
||||
limitations under the License.
|
||||
|
||||
The Original Code is______________________.
|
||||
|
||||
The Original Developer is not the Initial Developer and is __________. If left blank, the Original
|
||||
Developer is the Initial Developer.
|
||||
|
||||
The Initial Developer of the Original Code is ____________. All portions of the code written by
|
||||
___________ are Copyright (c) _____. All Rights Reserved.
|
||||
|
||||
Contributor ______________________.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms of the _____ license (the
|
||||
[___] License), in which case the provisions of [______] License are applicable instead of those
|
||||
above.
|
||||
|
||||
If you wish to allow use of your version of this file only under the terms of the [____] License
|
||||
and not to allow others to use your version of this file under the CPAL, indicate your decision by
|
||||
deleting the provisions above and replace them with the notice and other provisions required by
|
||||
the [___] License. If you do not delete the provisions above, a recipient may use your version of
|
||||
this file under either the CPAL or the [___] License."
|
||||
|
||||
[NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source
|
||||
Code files of the Original Code. You should use the text of this Exhibit A rather than the text
|
||||
found in the Original Code Source Code for Your Modifications.]
|
||||
|
||||
EXHIBIT B. Attribution Information
|
||||
|
||||
When the TableEditor is producing and/or controlling the display the Graphic Image must be
|
||||
displayed on the screen visible to the user in a manner comparable to that in the
|
||||
Original Code. The Attribution Phrase must be displayed as a "tooltip" or "hover-text" for
|
||||
that image. The image must be linked to the Attribution URL so as to access that page
|
||||
when clicked. If the user interface includes a prominent "about" display which includes
|
||||
factual prominent attribution in a form similar to that in the "about" display included
|
||||
with the Original Code, including Socialtext copyright notices and URLs, then the image
|
||||
need not be linked to the Attribution URL but the "tool-tip" is still required.
|
||||
|
||||
Attribution Copyright Notice:
|
||||
|
||||
Copyright (C) 2009 Socialtext, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Attribution Phrase (not exceeding 10 words): SocialCalc
|
||||
|
||||
Attribution URL: http://www.socialcalc.org
|
||||
|
||||
Graphic Image: The contents of the sc-logo.gif file in the Original Code or
|
||||
a suitable replacement from http://www.socialcalc.org/licenses specified as
|
||||
being for SocialCalc.
|
||||
|
||||
Display of Attribution Information is required in Larger Works which are defined
|
||||
in the CPAL as a work which combines Covered Code or portions thereof with code
|
||||
not governed by the terms of the CPAL.
|
||||
|
||||
|
||||
=========================================
|
||||
THE ARTISTIC LICENSE 2.0
|
||||
=========================================
|
||||
|
||||
The Artistic License 2.0
|
||||
|
||||
Copyright (c) 2000-2006, The Perl Foundation.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
This license establishes the terms under which a given free software
|
||||
Package may be copied, modified, distributed, and/or redistributed.
|
||||
The intent is that the Copyright Holder maintains some artistic
|
||||
control over the development of that Package while still keeping the
|
||||
Package available as open source and free software.
|
||||
|
||||
You are always permitted to make arrangements wholly outside of this
|
||||
license directly with the Copyright Holder of a given Package. If the
|
||||
terms of this license do not permit the full use that you propose to
|
||||
make of the Package, you should contact the Copyright Holder and seek
|
||||
a different licensing arrangement.
|
||||
|
||||
Definitions
|
||||
|
||||
"Copyright Holder" means the individual(s) or organization(s)
|
||||
named in the copyright notice for the entire Package.
|
||||
|
||||
"Contributor" means any party that has contributed code or other
|
||||
material to the Package, in accordance with the Copyright Holder's
|
||||
procedures.
|
||||
|
||||
"You" and "your" means any person who would like to copy,
|
||||
distribute, or modify the Package.
|
||||
|
||||
"Package" means the collection of files distributed by the
|
||||
Copyright Holder, and derivatives of that collection and/or of
|
||||
those files. A given Package may consist of either the Standard
|
||||
Version, or a Modified Version.
|
||||
|
||||
"Distribute" means providing a copy of the Package or making it
|
||||
accessible to anyone else, or in the case of a company or
|
||||
organization, to others outside of your company or organization.
|
||||
|
||||
"Distributor Fee" means any fee that you charge for Distributing
|
||||
this Package or providing support for this Package to another
|
||||
party. It does not mean licensing fees.
|
||||
|
||||
"Standard Version" refers to the Package if it has not been
|
||||
modified, or has been modified only in ways explicitly requested
|
||||
by the Copyright Holder.
|
||||
|
||||
"Modified Version" means the Package, if it has been changed, and
|
||||
such changes were not explicitly requested by the Copyright
|
||||
Holder.
|
||||
|
||||
"Original License" means this Artistic License as Distributed with
|
||||
the Standard Version of the Package, in its current version or as
|
||||
it may be modified by The Perl Foundation in the future.
|
||||
|
||||
"Source" form means the source code, documentation source, and
|
||||
configuration files for the Package.
|
||||
|
||||
"Compiled" form means the compiled bytecode, object code, binary,
|
||||
or any other form resulting from mechanical transformation or
|
||||
translation of the Source form.
|
||||
|
||||
|
||||
Permission for Use and Modification Without Distribution
|
||||
|
||||
(1) You are permitted to use the Standard Version and create and use
|
||||
Modified Versions for any purpose without restriction, provided that
|
||||
you do not Distribute the Modified Version.
|
||||
|
||||
|
||||
Permissions for Redistribution of the Standard Version
|
||||
|
||||
(2) You may Distribute verbatim copies of the Source form of the
|
||||
Standard Version of this Package in any medium without restriction,
|
||||
either gratis or for a Distributor Fee, provided that you duplicate
|
||||
all of the original copyright notices and associated disclaimers. At
|
||||
your discretion, such verbatim copies may or may not include a
|
||||
Compiled form of the Package.
|
||||
|
||||
(3) You may apply any bug fixes, portability changes, and other
|
||||
modifications made available from the Copyright Holder. The resulting
|
||||
Package will still be considered the Standard Version, and as such
|
||||
will be subject to the Original License.
|
||||
|
||||
|
||||
Distribution of Modified Versions of the Package as Source
|
||||
|
||||
(4) You may Distribute your Modified Version as Source (either gratis
|
||||
or for a Distributor Fee, and with or without a Compiled form of the
|
||||
Modified Version) provided that you clearly document how it differs
|
||||
from the Standard Version, including, but not limited to, documenting
|
||||
any non-standard features, executables, or modules, and provided that
|
||||
you do at least ONE of the following:
|
||||
|
||||
(a) make the Modified Version available to the Copyright Holder
|
||||
of the Standard Version, under the Original License, so that the
|
||||
Copyright Holder may include your modifications in the Standard
|
||||
Version.
|
||||
|
||||
(b) ensure that installation of your Modified Version does not
|
||||
prevent the user installing or running the Standard Version. In
|
||||
addition, the Modified Version must bear a name that is different
|
||||
from the name of the Standard Version.
|
||||
|
||||
(c) allow anyone who receives a copy of the Modified Version to
|
||||
make the Source form of the Modified Version available to others
|
||||
under
|
||||
|
||||
(i) the Original License or
|
||||
|
||||
(ii) a license that permits the licensee to freely copy,
|
||||
modify and redistribute the Modified Version using the same
|
||||
licensing terms that apply to the copy that the licensee
|
||||
received, and requires that the Source form of the Modified
|
||||
Version, and of any works derived from it, be made freely
|
||||
available in that license fees are prohibited but Distributor
|
||||
Fees are allowed.
|
||||
|
||||
|
||||
Distribution of Compiled Forms of the Standard Version
|
||||
or Modified Versions without the Source
|
||||
|
||||
(5) You may Distribute Compiled forms of the Standard Version without
|
||||
the Source, provided that you include complete instructions on how to
|
||||
get the Source of the Standard Version. Such instructions must be
|
||||
valid at the time of your distribution. If these instructions, at any
|
||||
time while you are carrying out such distribution, become invalid, you
|
||||
must provide new instructions on demand or cease further distribution.
|
||||
If you provide valid instructions or cease distribution within thirty
|
||||
days after you become aware that the instructions are invalid, then
|
||||
you do not forfeit any of your rights under this license.
|
||||
|
||||
(6) You may Distribute a Modified Version in Compiled form without
|
||||
the Source, provided that you comply with Section 4 with respect to
|
||||
the Source of the Modified Version.
|
||||
|
||||
|
||||
Aggregating or Linking the Package
|
||||
|
||||
(7) You may aggregate the Package (either the Standard Version or
|
||||
Modified Version) with other packages and Distribute the resulting
|
||||
aggregation provided that you do not charge a licensing fee for the
|
||||
Package. Distributor Fees are permitted, and licensing fees for other
|
||||
components in the aggregation are permitted. The terms of this license
|
||||
apply to the use and Distribution of the Standard or Modified Versions
|
||||
as included in the aggregation.
|
||||
|
||||
(8) You are permitted to link Modified and Standard Versions with
|
||||
other works, to embed the Package in a larger work of your own, or to
|
||||
build stand-alone binary or bytecode versions of applications that
|
||||
include the Package, and Distribute the result without restriction,
|
||||
provided the result does not expose a direct interface to the Package.
|
||||
|
||||
|
||||
Items That are Not Considered Part of a Modified Version
|
||||
|
||||
(9) Works (including, but not limited to, modules and scripts) that
|
||||
merely extend or make use of the Package, do not, by themselves, cause
|
||||
the Package to be a Modified Version. In addition, such works are not
|
||||
considered parts of the Package itself, and are not subject to the
|
||||
terms of this license.
|
||||
|
||||
|
||||
General Provisions
|
||||
|
||||
(10) Any use, modification, and distribution of the Standard or
|
||||
Modified Versions is governed by this Artistic License. By using,
|
||||
modifying or distributing the Package, you accept this license. Do not
|
||||
use, modify, or distribute the Package, if you do not accept this
|
||||
license.
|
||||
|
||||
(11) If your Modified Version has been derived from a Modified
|
||||
Version made by someone other than you, you are nevertheless required
|
||||
to ensure that your Modified Version complies with the requirements of
|
||||
this license.
|
||||
|
||||
(12) This license does not grant you the right to use any trademark,
|
||||
service mark, tradename, or logo of the Copyright Holder.
|
||||
|
||||
(13) This license includes the non-exclusive, worldwide,
|
||||
free-of-charge patent license to make, have made, use, offer to sell,
|
||||
sell, import and otherwise transfer the Package with respect to any
|
||||
patent claims licensable by the Copyright Holder that are necessarily
|
||||
infringed by the Package. If you institute patent litigation
|
||||
(including a cross-claim or counterclaim) against any party alleging
|
||||
that the Package constitutes direct or contributory patent
|
||||
infringement, then this Artistic License to you shall terminate on the
|
||||
date that such litigation is filed.
|
||||
|
||||
(14) Disclaimer of Warranty:
|
||||
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
||||
IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
||||
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
|
||||
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
[End of LICENSE.txt]
|
||||
|
||||
Includes third-party code from etherpad-lite licensed under the Apache license.
|
||||
|
||||
Apache license
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2013 THE ETHERPAD FOUNDATION
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -1,203 +0,0 @@
|
|||
Files: etherpad-lite.ico
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2013 THE ETHERPAD FOUNDATION
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1,182 +0,0 @@
|
|||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
(function(OCA) {
|
||||
OCA.FilesOwnpad = {
|
||||
attach: function(fileList) {
|
||||
this._extendFileActions(fileList.fileActions);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
$('#ownpad').remove();
|
||||
FileList.setViewerMode(false);
|
||||
|
||||
// replace the controls with our own
|
||||
$('#app-content #controls').removeClass('hidden');
|
||||
},
|
||||
|
||||
show: function(fileName, dirName) {
|
||||
var self = this;
|
||||
var $iframe;
|
||||
|
||||
var viewer = OC.generateUrl('/apps/ownpad/?file={file}&dir={dir}', {file: fileName, dir: dirName});
|
||||
|
||||
$iframe = $('<iframe id="ownpad" style="width:100%;height:100%;display:block;position:absolute;top:0;z-index:999;" src="'+viewer+'"/>');
|
||||
|
||||
FileList.setViewerMode(true);
|
||||
|
||||
$('#app-content').append($iframe);
|
||||
$("#pageWidthOption").attr("selected","selected");
|
||||
$('#app-content #controls').addClass('hidden');
|
||||
|
||||
$('#ownpad').load(function(){
|
||||
var iframe = $('#ownpad').contents();
|
||||
if ($('#fileList').length) {
|
||||
iframe.find('#ownpad_close').click(function() {
|
||||
self.hide();
|
||||
});
|
||||
} else {
|
||||
iframe.find("#ownpad_close").addClass('hidden');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_extendFileActions: function(fileActions) {
|
||||
var self = this;
|
||||
fileActions.registerAction({
|
||||
name: 'view',
|
||||
displayName: 'Ownpad',
|
||||
mime: 'application/x-ownpad',
|
||||
permissions: OC.PERMISSION_READ,
|
||||
actionHandler: function(fileName, context) {
|
||||
self.show(fileName, context.dir);
|
||||
}
|
||||
});
|
||||
fileActions.setDefault('application/x-ownpad', 'view');
|
||||
}
|
||||
};
|
||||
})(OCA);
|
||||
|
||||
OC.Plugins.register('OCA.Files.FileList', OCA.FilesOwnpad);
|
||||
|
||||
(function(OCA) {
|
||||
|
||||
var FilesOwnpadMenu = function() {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
FilesOwnpadMenu.prototype = {
|
||||
|
||||
_etherpadEnabled: false,
|
||||
_etherpadPublicEnabled: false,
|
||||
_etherpadAPIEnabled: false,
|
||||
_ethercalcEnabled: false,
|
||||
|
||||
initialize: function() {
|
||||
var self = this;
|
||||
|
||||
if(OC.getCurrentUser().uid !== null) {
|
||||
$.ajax({
|
||||
url: OC.generateUrl('/apps/ownpad/ajax/v1.0/getconfig')
|
||||
}).done(function(result) {
|
||||
self._etherpadEnabled = result.data.ownpad_etherpad_enable === "yes";
|
||||
self._etherpadPublicEnabled = result.data.ownpad_etherpad_public_enable === "yes";
|
||||
self._etherpadAPIEnabled = result.data.ownpad_etherpad_useapi === "yes";
|
||||
self._ethercalcEnabled = result.data.ownpad_ethercalc_enable === "yes";
|
||||
OC.Plugins.register('OCA.Files.NewFileMenu', self);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
attach: function(newFileMenu) {
|
||||
var self = this;
|
||||
|
||||
if(self._etherpadEnabled === true) {
|
||||
if (self._etherpadPublicEnabled === true || self._etherpadAPIEnabled === false) {
|
||||
newFileMenu.addMenuEntry({
|
||||
id: 'etherpad',
|
||||
displayName: t('ownpad', 'Pad'),
|
||||
templateName: t('ownpad', 'New pad.pad'),
|
||||
iconClass: 'icon-filetype-etherpad',
|
||||
fileType: 'etherpad',
|
||||
actionHandler: function (filename) {
|
||||
self._createPad("etherpad", filename);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(self._etherpadAPIEnabled === true) {
|
||||
var displayName = self._etherpadPublicEnabled === true ? 'Protected Pad' : 'Pad';
|
||||
var templateName = self._etherpadPublicEnabled === true ? 'New protected pad.pad' : 'New pad.pad';
|
||||
newFileMenu.addMenuEntry({
|
||||
id: 'etherpad-api',
|
||||
displayName: t('ownpad', displayName),
|
||||
templateName: t('ownpad', templateName),
|
||||
iconClass: 'icon-filetype-etherpad',
|
||||
fileType: 'etherpad',
|
||||
actionHandler: function(filename) {
|
||||
self._createPad("etherpad", filename, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(self._ethercalcEnabled === true) {
|
||||
newFileMenu.addMenuEntry({
|
||||
id: 'ethercalc',
|
||||
displayName: t('ownpad', 'Calc'),
|
||||
templateName: t('ownpad', 'New calc.calc'),
|
||||
iconClass: 'icon-filetype-ethercalc',
|
||||
fileType: 'ethercalc',
|
||||
actionHandler: function(filename) {
|
||||
self._createPad("ethercalc", filename);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_createPad: function(type, filename, is_protected) {
|
||||
// Default value for `is_protected`.
|
||||
var is_protected = typeof is_protected !== 'undefined' ? is_protected : false;
|
||||
|
||||
var self = this;
|
||||
|
||||
OCA.Files.Files.isFileNameValid(filename);
|
||||
filename = FileList.getUniqueName(filename);
|
||||
|
||||
$.post(
|
||||
OC.generateUrl('/apps/ownpad/ajax/v1.0/newpad'), {
|
||||
dir: $('#dir').val(),
|
||||
padname: filename,
|
||||
type: type,
|
||||
protected: is_protected
|
||||
},
|
||||
function(result) {
|
||||
if(result.status == 'success') {
|
||||
FileList.add(result.data, {animate: true, scrollTo: true});
|
||||
}
|
||||
else {
|
||||
OC.dialogs.alert(result.data.message, t('core', 'Could not create file'));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Only initialize the Ownpad menu when user is logged in and
|
||||
// using the “files” app.
|
||||
$(document).ready(function() {
|
||||
if($('#filesApp').val()) {
|
||||
OCA.FilesOwnpadMenu = new FilesOwnpadMenu();
|
||||
}
|
||||
});
|
||||
|
||||
})(OCA);
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
(function (window, document, $) {
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function() {
|
||||
var savedMessage = $('#ownpad-saved-message');
|
||||
|
||||
var saved = function () {
|
||||
if (savedMessage.is(':visible')) {
|
||||
savedMessage.hide();
|
||||
}
|
||||
|
||||
savedMessage.fadeIn(function () {
|
||||
setTimeout(function () {
|
||||
savedMessage.fadeOut();
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
$('#ownpad_settings input').change(function() {
|
||||
var value = $(this).val();
|
||||
|
||||
if($(this).attr('type') === 'checkbox') {
|
||||
if (this.checked) {
|
||||
value = 'yes';
|
||||
} else {
|
||||
value = 'no';
|
||||
}
|
||||
}
|
||||
|
||||
OC.AppConfig.setValue('ownpad', $(this).attr('name'), value);
|
||||
saved();
|
||||
});
|
||||
|
||||
$('#ownpad_etherpad_enable').change(function() {
|
||||
$("#ownpad_etherpad_settings").toggleClass('hidden', !this.checked);
|
||||
|
||||
if(this.checked && $("#ownpad_etherpad_useapi").is(":checked")) {
|
||||
$("#ownpad_etherpad_useapi_settings").removeClass('hidden');
|
||||
}
|
||||
else {
|
||||
$("#ownpad_etherpad_useapi_settings").addClass('hidden');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#ownpad_etherpad_useapi').change(function() {
|
||||
$("#ownpad_etherpad_useapi_settings").toggleClass('hidden', !this.checked);
|
||||
});
|
||||
|
||||
$('#ownpad_ethercalc_enable').change(function() {
|
||||
$("#ownpad_ethercalc_settings").toggleClass('hidden', !this.checked);
|
||||
});
|
||||
});
|
||||
|
||||
}(window, document, jQuery));
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
$TRANSLATIONS = array(
|
||||
'Calc' => 'Tableur collaboratif',
|
||||
'Collaborative Documents'=>'Documents collaboratifs',
|
||||
'Edit' => 'Éditer',
|
||||
'Ethercalc Host' => 'Hôte Ethercalc',
|
||||
'Etherpad Host' => 'Hôte Etherpad',
|
||||
'Etherpad cookie domain' => 'Domaine du cookie d’Etherpad',
|
||||
'Incorrect pad name' => 'Nom de pad incorrect',
|
||||
'New calc.calc' => 'Nouveau calc.calc'
|
||||
'New pad.pad' => 'Nouveau pad.pad',
|
||||
'New protected pad' => 'Nouveau pad protégé',
|
||||
'Pad' => 'Document collaboratif',
|
||||
'public link' => 'Lien public',
|
||||
'Protected Pad' => 'Pad protégé',
|
||||
'Saved' => 'Sauvegardé',
|
||||
'This is used to link collaborative documents inside Nextcloud.' => 'Ceci est utilisé pour établir des liens avec des documents collaboratifs dans Nextcloud',
|
||||
'Title' => 'Titre',
|
||||
'Unable to communicate with Etherpad API.' => 'Impossible de communiquer avec l’API d’Etherpad',
|
||||
'Use Etherpad API (*experimental*)' => 'Activer l’utilisation de l’API Etherpad (*experimental*)',
|
||||
'You need to enable Etherpad API if you want to create “protected” pads, that will only be accessible through Nextcloud. To make this work, you need to host your Etherpad instance in a sub of sibbling domain of the one that is used by Nextcloud (due to cookie isolation).' => 'Vous devez activer l’API d’Etherpad si vous voulez pouvoir créer des pad « protégés », qui seront accessibles uniquement au travers de Nextcloud. Pour que cela puisse fonctionner, vous devez héberger votre instance Etherpad dans un sous-domaine ou un domaine frère de celui utilisé par Nextcloud (pour des questions d’isolation de cookie).',
|
||||
'Your Etherpad/Ethercalc document could not be opened: the URL specified in your file does not match the allowed server.' => 'Votre document Etherpad/Ethercalc n’a pas pu être ouvert : l’URL contenue dans votre fichier ne correspond pas avec le serveur autorisé',
|
||||
);
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\AppInfo;
|
||||
|
||||
use OCP\AppFramework\App;
|
||||
use OCP\Util;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
public function __construct(array $urlParams = array()) {
|
||||
parent::__construct('ownpad', $urlParams);
|
||||
}
|
||||
|
||||
public function registerHooks() {
|
||||
$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
|
||||
$dispatcher->addListener(
|
||||
'OCA\Files::loadAdditionalScripts',
|
||||
function() {
|
||||
Util::addStyle('ownpad', 'ownpad');
|
||||
Util::addScript('ownpad', 'ownpad');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Controller;
|
||||
|
||||
use \OCP\IRequest;
|
||||
use \OCP\AppFramework\Controller;
|
||||
use \OCP\AppFramework\Http\JSONResponse;
|
||||
use \OCP\AppFramework\Http;
|
||||
|
||||
use OCA\Ownpad\Service\OwnpadService;
|
||||
use OCA\Ownpad\Service\OwnpadException;
|
||||
|
||||
class AjaxController extends Controller {
|
||||
|
||||
/** @var OwnpadService */
|
||||
private $service;
|
||||
|
||||
public function __construct($appName, IRequest $request, OwnpadService $service) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function getconfig() {
|
||||
$config = [];
|
||||
|
||||
$appConfig = \OC::$server->getConfig();
|
||||
$config['ownpad_etherpad_enable'] = $appConfig->getAppValue('ownpad', 'ownpad_etherpad_enable', 'no');
|
||||
$config['ownpad_etherpad_public_enable'] = $appConfig->getAppValue('ownpad', 'ownpad_etherpad_public_enable', 'no');
|
||||
$config['ownpad_etherpad_useapi'] = $appConfig->getAppValue('ownpad', 'ownpad_etherpad_useapi', 'no');
|
||||
$config['ownpad_ethercalc_enable'] = $appConfig->getAppValue('ownpad', 'ownpad_ethercalc_enable', 'no');
|
||||
|
||||
return new JSONResponse(["data" => $config]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function newpad($dir, $padname, $type, $protected) {
|
||||
$dir = isset($dir) ? '/'.trim($dir, '/\\') : '';
|
||||
$padname = isset($padname) ? trim($padname, '/\\') : '';
|
||||
$type = isset($type) ? trim($type, '/\\') : '';
|
||||
$protected = isset($protected) && $protected === 'true' ? true : false;
|
||||
|
||||
try {
|
||||
$data = $this->service->create($dir, $padname, $type, $protected);
|
||||
return new JSONResponse([
|
||||
'data' => $data,
|
||||
'status' => 'success',
|
||||
]);
|
||||
}
|
||||
catch(OwnpadException $e) {
|
||||
$message = [
|
||||
'data' => ['message' => $e->getMessage()],
|
||||
'status' => 'error',
|
||||
];
|
||||
return new JSONResponse($message, Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,200 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Controller;
|
||||
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\ContentSecurityPolicy;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUserSession;
|
||||
use OCP\IConfig;
|
||||
|
||||
use EtherpadLite\Client;
|
||||
|
||||
class DisplayController extends Controller {
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
/** @var IUserSession */
|
||||
private $userSession;
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/** @var Client */
|
||||
private $eplInstance;
|
||||
|
||||
/**
|
||||
* @param string $AppName
|
||||
* @param IRequest $request
|
||||
* @param IURLGenerator $urlGenerator
|
||||
*/
|
||||
public function __construct(
|
||||
$AppName,
|
||||
IRequest $request,
|
||||
IURLGenerator $urlGenerator,
|
||||
IUserSession $userSession,
|
||||
IConfig $config
|
||||
) {
|
||||
parent::__construct($AppName, $request);
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->userSession = $userSession;
|
||||
$this->config = $config;
|
||||
|
||||
if($this->config->getAppValue('ownpad', 'ownpad_etherpad_enable', 'no') !== 'no' AND
|
||||
$this->config->getAppValue('ownpad', 'ownpad_etherpad_useapi', 'no') !== 'no')
|
||||
{
|
||||
$eplHost = $this->config->getAppValue('ownpad', 'ownpad_etherpad_host', '');
|
||||
$eplApiKey = $this->config->getAppValue('ownpad', 'ownpad_etherpad_apikey', '');
|
||||
$this->eplInstance = new Client($eplApiKey, $eplHost . "/api");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @PublicPage
|
||||
* @NoCSRFRequired
|
||||
*
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function showPad($file, $dir) {
|
||||
/*
|
||||
* Filesystem is not setup per default on normal route since
|
||||
* Nextcloud 21. More information:
|
||||
* - https://github.com/nextcloud/server/issues/23210
|
||||
* - https://github.com/nextcloud/server/pull/23821
|
||||
*/
|
||||
\OC_Util::setupFS();
|
||||
|
||||
/* Retrieve file content to find pad’s URL */
|
||||
$path = \OC\Files\Filesystem::normalizePath($dir."/".$file);
|
||||
$content = \OC\Files\Filesystem::file_get_contents($path);
|
||||
preg_match('/URL=(.*)$/', $content, $matches);
|
||||
$url = $matches[1];
|
||||
$title = $file;
|
||||
|
||||
$eplHost = $this->config->getAppValue('ownpad', 'ownpad_etherpad_host', '');
|
||||
$eplHost = rtrim($eplHost, '/');
|
||||
$protectedPadRegex = sprintf('/%s\/p\/(g\.\w{16})\\$(.*)$/', preg_quote($eplHost, '/'));
|
||||
$match = preg_match($protectedPadRegex, $url, $matches);
|
||||
|
||||
/*
|
||||
* We are facing a “protected” pad. Call for Etherpad API to
|
||||
* create the session and then properly configure the cookie.
|
||||
*/
|
||||
if($match) {
|
||||
$groupID = $matches[1];
|
||||
|
||||
$username = $this->userSession->getUser()->getUID();
|
||||
$displayName = $this->userSession->getUser()->getDisplayName();
|
||||
$author = $this->eplInstance->createAuthorIfNotExistsFor($username, $displayName);
|
||||
|
||||
$session = $this->eplInstance->createSession($groupID, $author->authorID, time() + 3600);
|
||||
|
||||
$cookieDomain = $this->config->getAppValue('ownpad', 'ownpad_etherpad_cookie_domain', '');
|
||||
setcookie('sessionID', $session->sessionID, 0, '/', $cookieDomain, true, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Not totally sure that this is the right way to proceed…
|
||||
*
|
||||
* First we decode the URL (to avoid double encode), then we
|
||||
* replace spaces with underscore (as they are converted as
|
||||
* such by Etherpad), then we encode the URL properly (and we
|
||||
* avoid to urlencode() the protocol scheme).
|
||||
*
|
||||
* Magic urlencode() function was stolen from this answer on
|
||||
* StackOverflow: <http://stackoverflow.com/a/7974253>.
|
||||
*/
|
||||
$url = urldecode($url);
|
||||
$url = str_replace(' ', '_', $url);
|
||||
$url = preg_replace_callback('#://([^/]+)/(=)?([^?]+)#', function ($match) {
|
||||
return '://' . $match[1] . '/' . $match[2] . join('/', array_map('rawurlencode', explode('/', $match[3])));
|
||||
}, $url);
|
||||
|
||||
$params = [
|
||||
'urlGenerator' => $this->urlGenerator,
|
||||
'url' => $url,
|
||||
'title' => $title,
|
||||
];
|
||||
|
||||
|
||||
// Check for valid URL
|
||||
// Get File-Ending
|
||||
$split = explode(".", $file);
|
||||
$fileending = $split[count($split)-1];
|
||||
|
||||
// Get Host-URL
|
||||
if($fileending === "calc") {
|
||||
$host = \OC::$server->getConfig()->getAppValue('ownpad', 'ownpad_ethercalc_host', false);
|
||||
}
|
||||
elseif($fileending === "pad") {
|
||||
$host = \OC::$server->getConfig()->getAppValue('ownpad', 'ownpad_etherpad_host', false);
|
||||
}
|
||||
|
||||
if(substr($host, -1, 1) !== '/') {
|
||||
$host .= '/';
|
||||
}
|
||||
|
||||
// Escape all RegEx-Characters
|
||||
$hostreg = preg_quote($host);
|
||||
// Escape all Slashes in URL to use in RegEx
|
||||
$hostreg = preg_replace("/\//", "\/", $host);
|
||||
|
||||
// Final Regex-String
|
||||
if($fileending === "calc") {
|
||||
/*
|
||||
* Ethercalc documents with “multisheet” support starts
|
||||
* with a `=`.
|
||||
*/
|
||||
$regex = "/^".$hostreg."=?[^\/]+$/";
|
||||
}
|
||||
elseif($fileending === "pad") {
|
||||
/*
|
||||
* Etherpad documents can contain special characters, for
|
||||
* “protected pads” for example.
|
||||
*/
|
||||
$regex = "/^".$hostreg."p\/[^\/]+$/";
|
||||
}
|
||||
|
||||
// Show the Pad, if URL is valid
|
||||
if (preg_match($regex, $url) === 1) {
|
||||
$response = new TemplateResponse($this->appName, 'viewer', $params, 'blank');
|
||||
}
|
||||
else { // Show Error-Page
|
||||
$response = new TemplateResponse($this->appName, 'noviewer', $params, 'blank');
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow Etherpad and Ethercalc domains to the
|
||||
* Content-Security-frame- list.
|
||||
*
|
||||
* This feature was introduced in ownCloud 8.1.
|
||||
*/
|
||||
$policy = new ContentSecurityPolicy();
|
||||
|
||||
if($this->config->getAppValue('ownpad', 'ownpad_etherpad_enable', 'no') !== 'no') {
|
||||
$policy->addAllowedFrameDomain($this->config->getAppValue('ownpad', 'ownpad_etherpad_host', ''));
|
||||
$policy->addAllowedChildSrcDomain($this->config->getAppValue('ownpad', 'ownpad_etherpad_host', ''));
|
||||
}
|
||||
|
||||
if($this->config->getAppValue('ownpad', 'ownpad_ethercalc_enable', 'no') !== 'no') {
|
||||
$policy->addAllowedFrameDomain($this->config->getAppValue('ownpad', 'ownpad_ethercalc_host', ''));
|
||||
$policy->addAllowedChildSrcDomain($this->config->getAppValue('ownpad', 'ownpad_ethercalc_host', ''));
|
||||
}
|
||||
|
||||
$response->setContentSecurityPolicy($policy);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Ole Reglitzki <frissdiegurke@protonmail.com>
|
||||
* @copyright Ole Reglitzki <frissdiegurke@protonmail.com>, 2018
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Migration;
|
||||
|
||||
use OCP\Migration\IRepairStep;
|
||||
use OCP\IConfig;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
class ConfigPublicEnable implements IRepairStep {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return '0.6.6 introduces a new checkbox to enable/disable public pads if protected pads are enabled.';
|
||||
}
|
||||
|
||||
public function run(IOutput $output) {
|
||||
$installedVersion = $this->config->getAppValue('ownpad', 'installed_version', '0.0.0');
|
||||
if(version_compare($installedVersion, '0.6.6', '<') AND $installedVersion !== '0.0.0') {
|
||||
$appConfig = \OC::$server->getConfig();
|
||||
|
||||
$enabled = ($appConfig->getAppValue('ownpad', 'ownpad_etherpad_public_enable', '') === '') ? 'yes' : 'no';
|
||||
$appConfig->setAppValue('ownpad', 'ownpad_etherpad_public_enable', $enabled);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Migration;
|
||||
|
||||
use OCP\Migration\IRepairStep;
|
||||
use OCP\IConfig;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
class MigrateSettings implements IRepairStep {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct(IConfig $config) {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return '0.5.2 introduces a new checkbox to enable/disable Etherpad/Ethercalc.';
|
||||
}
|
||||
|
||||
public function run(IOutput $output) {
|
||||
$installedVersion = $this->config->getAppValue('ownpad', 'installed_version', '0.0.0');
|
||||
if(version_compare($installedVersion, '0.5.2', '<')) {
|
||||
$appConfig = \OC::$server->getConfig();
|
||||
|
||||
$enabled = ($appConfig->getAppValue('ownpad', 'ownpad_etherpad_host', '') !== '') ? 'yes' : 'no';
|
||||
$appConfig->setAppValue('ownpad', 'ownpad_etherpad_enable', $enabled);
|
||||
|
||||
$enabled = ($appConfig->getAppValue('ownpad', 'ownpad_ethercalc_host', '') !== '') ? 'yes' : 'no';
|
||||
$appConfig->setAppValue('ownpad', 'ownpad_ethercalc_enable', $enabled);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Service;
|
||||
|
||||
class OwnpadException extends \Exception {
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Service;
|
||||
|
||||
use Exception;
|
||||
|
||||
class OwnpadService {
|
||||
|
||||
public function create($dir, $padname, $type, $protected) {
|
||||
// Generate a random pad name
|
||||
$token = \OC::$server->getSecureRandom()->generate(16, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
|
||||
|
||||
$l10n = \OC::$server->getL10N('ownpad');
|
||||
$l10n_files = \OC::$server->getL10N('files');
|
||||
|
||||
$result = ['success' => false,
|
||||
'data' => NULL];
|
||||
|
||||
if($type === "ethercalc") {
|
||||
$ext = "calc";
|
||||
$host = \OC::$server->getConfig()->getAppValue('ownpad', 'ownpad_ethercalc_host', false);
|
||||
|
||||
/*
|
||||
* Prepend the calc’s name with a `=` to enable multisheet
|
||||
* support.
|
||||
*
|
||||
* More info:
|
||||
* – https://github.com/audreyt/ethercalc/issues/138
|
||||
* – https://github.com/otetard/ownpad/issues/26
|
||||
*/
|
||||
$url = sprintf("%s/=%s", rtrim($host, "/"), $token);
|
||||
}
|
||||
elseif($type === "etherpad") {
|
||||
$padID = $token;
|
||||
|
||||
$config = \OC::$server->getConfig();
|
||||
if($config->getAppValue('ownpad', 'ownpad_etherpad_enable', 'no') !== 'no' AND $config->getAppValue('ownpad', 'ownpad_etherpad_useapi', 'no') !== 'no') {
|
||||
try {
|
||||
$eplHost = $config->getAppValue('ownpad', 'ownpad_etherpad_host', '');
|
||||
$eplApiKey = $config->getAppValue('ownpad', 'ownpad_etherpad_apikey', '');
|
||||
$eplInstance = new \EtherpadLite\Client($eplApiKey, $eplHost . "/api");
|
||||
|
||||
if($protected === true) {
|
||||
// Create a protected (group) pad via API
|
||||
$group = $eplInstance->createGroup();
|
||||
$groupPad = $eplInstance->createGroupPad($group->groupID, $token);
|
||||
$padID = $groupPad->padID;
|
||||
}
|
||||
else {
|
||||
// Create a public pad via API
|
||||
$createPadResult = $eplInstance->createPad($token);
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
throw new OwnpadException($l10n->t('Unable to communicate with Etherpad API.'));
|
||||
}
|
||||
}
|
||||
|
||||
$ext = "pad";
|
||||
$host = \OC::$server->getConfig()->getAppValue('ownpad', 'ownpad_etherpad_host', false);
|
||||
$url = sprintf("%s/p/%s", rtrim($host, "/"), $padID);
|
||||
}
|
||||
|
||||
if($padname === '' || $padname === '.' || $padname === '..') {
|
||||
throw new OwnpadException($l10n->t('Incorrect padname.'));
|
||||
}
|
||||
|
||||
try {
|
||||
$view = new \OC\Files\View();
|
||||
$view->verifyPath($dir, $padname);
|
||||
}
|
||||
catch(\OCP\Files\InvalidPathException $ex) {
|
||||
throw new OwnpadException($l10n_files->t("Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
|
||||
}
|
||||
|
||||
if(!\OC\Files\Filesystem::file_exists($dir . '/')) {
|
||||
throw new OwnpadException($l10n_files->t('The target folder has been moved or deleted.'));
|
||||
}
|
||||
|
||||
// Add the extension only if padname doesn’t contain it
|
||||
if(substr($padname, -strlen(".$ext")) !== ".$ext") {
|
||||
$filename = "$padname.$ext";
|
||||
}
|
||||
else {
|
||||
$filename = $padname;
|
||||
}
|
||||
|
||||
$target = $dir . "/" . $filename;
|
||||
|
||||
if(\OC\Files\Filesystem::file_exists($target)) {
|
||||
throw new OwnpadException($l10n_files->t('The name %s is already used in the folder %s. Please choose a different name.', [$filename, $dir]));
|
||||
}
|
||||
|
||||
$content = sprintf("[InternetShortcut]\nURL=%s", $url);
|
||||
|
||||
if(\OC\Files\Filesystem::file_put_contents($target, $content)) {
|
||||
$meta = \OC\Files\Filesystem::getFileInfo($target);
|
||||
return \OCA\Files\Helper::formatFileInfo($meta);
|
||||
}
|
||||
|
||||
throw new OwnpadException($l10n_files->t('Error when creating the file'));
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Nextcloud - Ownpad
|
||||
*
|
||||
* This file is licensed under the Affero General Public License
|
||||
* version 3 or later. See the COPYING file.
|
||||
*
|
||||
* @author Olivier Tétard <olivier.tetard@miskin.fr>
|
||||
* @copyright Olivier Tétard <olivier.tetard@miskin.fr>, 2017
|
||||
*/
|
||||
|
||||
namespace OCA\Ownpad\Settings;
|
||||
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\Settings\ISettings;
|
||||
|
||||
class AdminSettings implements ISettings {
|
||||
|
||||
/** @var string */
|
||||
protected $appName;
|
||||
|
||||
/** @var IConfig */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param string $appName
|
||||
* @param IConfig $config
|
||||
*/
|
||||
public function __construct($appName, IConfig $config) {
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateResponse
|
||||
*/
|
||||
public function getForm() {
|
||||
$ownpad_mimetype_ep_configured = "no";
|
||||
$ownpad_mimetype_ec_configured = "no";
|
||||
|
||||
if(\OC::$server->getMimeTypeDetector()->detectPath("test.pad") === 'application/x-ownpad') {
|
||||
$ownpad_mimetype_ep_configured = "yes";
|
||||
}
|
||||
|
||||
if(\OC::$server->getMimeTypeDetector()->detectPath("test.calc") === 'application/x-ownpad') {
|
||||
$ownpad_mimetype_ec_configured = "yes";
|
||||
}
|
||||
|
||||
return new TemplateResponse($this->appName, 'settings', [
|
||||
'ownpad_etherpad_enable' => $this->config->getAppValue('ownpad', 'ownpad_etherpad_enable', 'no'),
|
||||
'ownpad_etherpad_host' => $this->config->getAppValue('ownpad', 'ownpad_etherpad_host', ''),
|
||||
'ownpad_etherpad_useapi' => $this->config->getAppValue('ownpad', 'ownpad_etherpad_useapi', 'no'),
|
||||
'ownpad_etherpad_public_enable' => $this->config->getAppValue('ownpad', 'ownpad_etherpad_public_enable', 'no'),
|
||||
'ownpad_etherpad_apikey' => $this->config->getAppValue('ownpad', 'ownpad_etherpad_apikey', ''),
|
||||
'ownpad_etherpad_cookie_domain' => $this->config->getAppValue('ownpad', 'ownpad_etherpad_cookie_domain', ''),
|
||||
'ownpad_ethercalc_enable' => $this->config->getAppValue('ownpad', 'ownpad_ethercalc_enable', 'no'),
|
||||
'ownpad_ethercalc_host' => $this->config->getAppValue('ownpad', 'ownpad_ethercalc_host', ''),
|
||||
'ownpad_mimetype_ep_configured' => $ownpad_mimetype_ep_configured,
|
||||
'ownpad_mimetype_ec_configured' => $ownpad_mimetype_ec_configured,
|
||||
], 'blank');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string the section ID, e.g. 'sharing'
|
||||
*/
|
||||
public function getSection() {
|
||||
return 'additional';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int whether the form should be rather on the top or bottom of
|
||||
* the admin section. The forms are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
*
|
||||
* E.g.: 70
|
||||
*/
|
||||
public function getPriority() {
|
||||
return 30;
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 72 KiB |
Binary file not shown.
Before Width: | Height: | Size: 60 KiB |
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
/** @var array $_ */
|
||||
/** @var OCP\IURLGenerator $urlGenerator */
|
||||
$urlGenerator = $_['urlGenerator'];
|
||||
$version = \OCP\App::getAppVersion('ownpad');
|
||||
$url = $_['url'];
|
||||
$title = $_['title'];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html style="height: 100%;">
|
||||
<head>
|
||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('ownpad', 'css/ownpad.css')) ?>?v=<?php p($version) ?>"/>
|
||||
</head>
|
||||
<body style="margin: 0px; padding: 0px; overflow: hidden; bottom: 37px; top: 0px; left: 0px; right: 0px; position: absolute;">
|
||||
<div id="ownpad_bar">
|
||||
<span>Title</span><strong><?php p($title); ?></strong><a id="ownpad_close">x</a>
|
||||
</div>
|
||||
<p><?php p($l->t("Your Etherpad/Ethercalc document could not be opened: the URL specified in your file does not match the allowed server.")); ?></p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
/** @var \OCP\IL10N $l */
|
||||
/** @var array $_ */
|
||||
|
||||
script('ownpad', 'settings');
|
||||
style('ownpad', 'settings');
|
||||
?>
|
||||
<div class="section" id="ownpad">
|
||||
<form id="ownpad_settings">
|
||||
|
||||
<h2><?php p($l->t('Ownpad (collaborative documents)'));?></h2>
|
||||
|
||||
<p class="settings-hint"><?php p($l->t('This is used to link collaborative documents inside Nextcloud.')); ?></p>
|
||||
|
||||
<?php if ($_['ownpad_mimetype_ep_configured'] !== 'yes' || $_['ownpad_mimetype_ec_configured'] !== 'yes') { ?>
|
||||
<p class="settings-hint"><b><?php p($l->t('Ownpad is not correctly configured, you should update your configuration. Please refer to the documentation for more information.')); ?></b></p>
|
||||
<?php } ?>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="ownpad_etherpad_enable" id="ownpad_etherpad_enable" class="checkbox"
|
||||
value="1" <?php if ($_['ownpad_etherpad_enable'] === 'yes') print_unescaped('checked="checked"'); ?> />
|
||||
<label for="ownpad_etherpad_enable"><?php p($l->t('Enable Etherpad'));?></label><br/>
|
||||
</p>
|
||||
|
||||
<p id="ownpad_etherpad_settings" class="indent <?php if ($_['ownpad_etherpad_enable'] !== 'yes') p('hidden'); ?>">
|
||||
<label for="ownpad_etherpad_host"><?php p($l->t('Etherpad Host')); ?></label>
|
||||
<input type="text" name="ownpad_etherpad_host" id="ownpad_etherpad_host"
|
||||
value="<?php p($_['ownpad_etherpad_host']); ?>"
|
||||
placeholder="https://beta.etherpad.org/" />
|
||||
<br/>
|
||||
|
||||
<input type="checkbox" name="ownpad_etherpad_useapi" id="ownpad_etherpad_useapi" class="checkbox"
|
||||
value="1" <?php if ($_['ownpad_etherpad_useapi'] === 'yes') print_unescaped('checked="checked"'); ?> />
|
||||
<label for="ownpad_etherpad_useapi"><?php p($l->t('Use Etherpad API (*experimental*)'));?></label><br/>
|
||||
|
||||
<em>
|
||||
<?php p($l->t('You need to enable Etherpad API if you want to create “protected” pads, that will only be accessible through Nextcloud.')); ?><br/>
|
||||
<?php p($l->t('You have to host your Etherpad instance in a subdomain or sibbling domain of the one that is used by Nextcloud (due to cookie isolation).')); ?>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<p id="ownpad_etherpad_useapi_settings" class="double-indent <?php if ($_['ownpad_etherpad_enable'] !== 'yes' || $_['ownpad_etherpad_useapi'] !== 'yes') p('hidden'); ?>">
|
||||
|
||||
<input type="checkbox" name="ownpad_etherpad_public_enable" id="ownpad_etherpad_public_enable" class="checkbox"
|
||||
value="1" <?php if ($_['ownpad_etherpad_public_enable'] === 'yes') print_unescaped('checked="checked"'); ?> />
|
||||
<label for="ownpad_etherpad_public_enable"><?php p($l->t('Allow “public” pads'));?></label><br/>
|
||||
|
||||
<label for="ownpad_etherpad_apikey"><?php p($l->t('Etherpad Apikey')); ?></label><br/>
|
||||
<input type="text" name="ownpad_etherpad_apikey" id="ownpad_etherpad_apikey" value="<?php p($_['ownpad_etherpad_apikey']); ?>" /><br/>
|
||||
|
||||
|
||||
<label for="ownpad_etherpad_cookie_domain"><?php p($l->t('Etherpad cookie domain')); ?></label><br/>
|
||||
<em>
|
||||
<?php p($l->t('For example, if you host your Etherpad instance on `pad.example.org` and your Nextcloud instance on `cloud.example.org` you need to configure your cookie to `example.org` domain.')); ?>
|
||||
</em><br/>
|
||||
<input type="text" name="ownpad_etherpad_cookie_domain" id="ownpad_etherpad_cookie_domain" value="<?php p($_['ownpad_etherpad_cookie_domain']); ?>" /><br/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="checkbox" name="ownpad_ethercalc_enable" id="ownpad_ethercalc_enable" class="checkbox"
|
||||
value="1" <?php if ($_['ownpad_ethercalc_enable'] === 'yes') print_unescaped('checked="checked"'); ?> />
|
||||
<label for="ownpad_ethercalc_enable"><?php p($l->t('Enable Ethercalc'));?></label><br/>
|
||||
</p>
|
||||
|
||||
<div id="ownpad_ethercalc_settings" class="indent <?php if ($_['ownpad_ethercalc_enable'] !== 'yes') p('hidden'); ?>">
|
||||
<p>
|
||||
<label for="ownpad_ethercalc_host"><?php p($l->t('Ethercalc Host')); ?></label>
|
||||
<input type="text" name="ownpad_ethercalc_host" id="ownpad_ethercalc_host"
|
||||
value="<?php p($_['ownpad_ethercalc_host']); ?>"
|
||||
placeholder="https://ethercalc.org" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="ownpad-saved-message">
|
||||
<span class="msg success"><?php p($l->t('Saved')); ?></span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
/** @var array $_ */
|
||||
/** @var OCP\IURLGenerator $urlGenerator */
|
||||
$urlGenerator = $_['urlGenerator'];
|
||||
$version = \OCP\App::getAppVersion('ownpad');
|
||||
$url = $_['url'];
|
||||
$title = $_['title'];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html style="height: 100%;">
|
||||
<head>
|
||||
<link rel="stylesheet" href="<?php p($urlGenerator->linkTo('ownpad', 'css/ownpad.css')) ?>?v=<?php p($version) ?>"/>
|
||||
</head>
|
||||
<body style="margin: 0px; padding: 0px; overflow: hidden; bottom: 37px; top: 0px; left: 0px; right: 0px; position: absolute;">
|
||||
<div id="ownpad_bar">
|
||||
<span>Title</span><strong><?php p($title); ?></strong><span><a target="_parent" href="<?php p($url); ?>"><?php p($url); ?></a></span><a id="ownpad_close">x</a>
|
||||
</div>
|
||||
<iframe frameborder="0" id="ownpad_frame" style="overflow:hidden;width:100%;height:100%;display:block;" height="100%" width="100%" src="<?php p($url); ?>"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"classmap-authoritative": true
|
||||
},
|
||||
"require": {
|
||||
"onelogin/php-saml": "^3.0",
|
||||
"firebase/php-jwt": "^4.0"
|
||||
}
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f3e661f8388070704bd9b01b48752bf0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "firebase/php-jwt",
|
||||
"version": "v4.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/firebase/php-jwt.git",
|
||||
"reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35",
|
||||
"reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Firebase\\JWT\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Neuman Vong",
|
||||
"email": "neuman+pear@twilio.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Anant Narayanan",
|
||||
"email": "anant@php.net",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
||||
"homepage": "https://github.com/firebase/php-jwt",
|
||||
"time": "2016-07-18T04:51:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "onelogin/php-saml",
|
||||
"version": "3.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/onelogin/php-saml.git",
|
||||
"reference": "5fbf3486704ac9835b68184023ab54862c95f213"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/onelogin/php-saml/zipball/5fbf3486704ac9835b68184023ab54862c95f213",
|
||||
"reference": "5fbf3486704ac9835b68184023ab54862c95f213",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"robrichards/xmlseclibs": ">=3.0.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"pdepend/pdepend": "^2.5.0",
|
||||
"php-coveralls/php-coveralls": "^1.0.2 || ^2.0",
|
||||
"phploc/phploc": "^2.1 || ^3.0 || ^4.0",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1",
|
||||
"sebastian/phpcpd": "^2.0 || ^3.0 || ^4.0",
|
||||
"squizlabs/php_codesniffer": "^3.1.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs",
|
||||
"ext-gettext": "Install gettext and php5-gettext libs to handle translations",
|
||||
"ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OneLogin\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "OneLogin PHP SAML Toolkit",
|
||||
"homepage": "https://developers.onelogin.com/saml/php",
|
||||
"keywords": [
|
||||
"SAML2",
|
||||
"onelogin",
|
||||
"saml"
|
||||
],
|
||||
"time": "2019-11-25T17:30:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "robrichards/xmlseclibs",
|
||||
"version": "3.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/robrichards/xmlseclibs.git",
|
||||
"reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/f8f19e58f26cdb42c54b214ff8a820760292f8df",
|
||||
"reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-openssl": "*",
|
||||
"php": ">= 5.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RobRichards\\XMLSecLibs\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "A PHP library for XML Security",
|
||||
"homepage": "https://github.com/robrichards/xmlseclibs",
|
||||
"keywords": [
|
||||
"security",
|
||||
"signature",
|
||||
"xml",
|
||||
"xmldsig"
|
||||
],
|
||||
"time": "2020-09-05T13:00:25+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitcc75f134f7630c1ee3a8e4d7c86f3bcc::getLoader();
|
|
@ -1,477 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
}
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
//no-op
|
||||
} elseif ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||
*
|
||||
* @return self[]
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class InstalledVersions
|
||||
{
|
||||
private static $installed = array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '4e74fb44d08ff9e669c4a44db697badf8bdf2996',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '4e74fb44d08ff9e669c4a44db697badf8bdf2996',
|
||||
),
|
||||
'firebase/php-jwt' =>
|
||||
array (
|
||||
'pretty_version' => 'v4.0.0',
|
||||
'version' => '4.0.0.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'dccf163dc8ed7ed6a00afc06c51ee5186a428d35',
|
||||
),
|
||||
'onelogin/php-saml' =>
|
||||
array (
|
||||
'pretty_version' => '3.4.1',
|
||||
'version' => '3.4.1.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '5fbf3486704ac9835b68184023ab54862c95f213',
|
||||
),
|
||||
'robrichards/xmlseclibs' =>
|
||||
array (
|
||||
'pretty_version' => '3.1.1',
|
||||
'version' => '3.1.1.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'f8f19e58f26cdb42c54b214ff8a820760292f8df',
|
||||
),
|
||||
),
|
||||
);
|
||||
private static $canGetVendors;
|
||||
private static $installedByVendor = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function isInstalled($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints($constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRawData()
|
||||
{
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$installed[] = self::$installed;
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'Firebase\\JWT\\BeforeValidException' => $vendorDir . '/firebase/php-jwt/src/BeforeValidException.php',
|
||||
'Firebase\\JWT\\ExpiredException' => $vendorDir . '/firebase/php-jwt/src/ExpiredException.php',
|
||||
'Firebase\\JWT\\JWT' => $vendorDir . '/firebase/php-jwt/src/JWT.php',
|
||||
'Firebase\\JWT\\SignatureInvalidException' => $vendorDir . '/firebase/php-jwt/src/SignatureInvalidException.php',
|
||||
'OneLogin\\Saml2\\Auth' => $vendorDir . '/onelogin/php-saml/src/Saml2/Auth.php',
|
||||
'OneLogin\\Saml2\\AuthnRequest' => $vendorDir . '/onelogin/php-saml/src/Saml2/AuthnRequest.php',
|
||||
'OneLogin\\Saml2\\Constants' => $vendorDir . '/onelogin/php-saml/src/Saml2/Constants.php',
|
||||
'OneLogin\\Saml2\\Error' => $vendorDir . '/onelogin/php-saml/src/Saml2/Error.php',
|
||||
'OneLogin\\Saml2\\IdPMetadataParser' => $vendorDir . '/onelogin/php-saml/src/Saml2/IdPMetadataParser.php',
|
||||
'OneLogin\\Saml2\\LogoutRequest' => $vendorDir . '/onelogin/php-saml/src/Saml2/LogoutRequest.php',
|
||||
'OneLogin\\Saml2\\LogoutResponse' => $vendorDir . '/onelogin/php-saml/src/Saml2/LogoutResponse.php',
|
||||
'OneLogin\\Saml2\\Metadata' => $vendorDir . '/onelogin/php-saml/src/Saml2/Metadata.php',
|
||||
'OneLogin\\Saml2\\Response' => $vendorDir . '/onelogin/php-saml/src/Saml2/Response.php',
|
||||
'OneLogin\\Saml2\\Settings' => $vendorDir . '/onelogin/php-saml/src/Saml2/Settings.php',
|
||||
'OneLogin\\Saml2\\Utils' => $vendorDir . '/onelogin/php-saml/src/Saml2/Utils.php',
|
||||
'OneLogin\\Saml2\\ValidationError' => $vendorDir . '/onelogin/php-saml/src/Saml2/ValidationError.php',
|
||||
'RobRichards\\XMLSecLibs\\Utils\\XPath' => $vendorDir . '/robrichards/xmlseclibs/src/Utils/XPath.php',
|
||||
'RobRichards\\XMLSecLibs\\XMLSecEnc' => $vendorDir . '/robrichards/xmlseclibs/src/XMLSecEnc.php',
|
||||
'RobRichards\\XMLSecLibs\\XMLSecurityDSig' => $vendorDir . '/robrichards/xmlseclibs/src/XMLSecurityDSig.php',
|
||||
'RobRichards\\XMLSecLibs\\XMLSecurityKey' => $vendorDir . '/robrichards/xmlseclibs/src/XMLSecurityKey.php',
|
||||
);
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'RobRichards\\XMLSecLibs\\' => array($vendorDir . '/robrichards/xmlseclibs/src'),
|
||||
'OneLogin\\' => array($vendorDir . '/onelogin/php-saml/src'),
|
||||
'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
|
||||
);
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitcc75f134f7630c1ee3a8e4d7c86f3bcc
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitcc75f134f7630c1ee3a8e4d7c86f3bcc', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitcc75f134f7630c1ee3a8e4d7c86f3bcc', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitcc75f134f7630c1ee3a8e4d7c86f3bcc::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitcc75f134f7630c1ee3a8e4d7c86f3bcc
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'R' =>
|
||||
array (
|
||||
'RobRichards\\XMLSecLibs\\' => 23,
|
||||
),
|
||||
'O' =>
|
||||
array (
|
||||
'OneLogin\\' => 9,
|
||||
),
|
||||
'F' =>
|
||||
array (
|
||||
'Firebase\\JWT\\' => 13,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'RobRichards\\XMLSecLibs\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/robrichards/xmlseclibs/src',
|
||||
),
|
||||
'OneLogin\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/onelogin/php-saml/src',
|
||||
),
|
||||
'Firebase\\JWT\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/firebase/php-jwt/src',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'Firebase\\JWT\\BeforeValidException' => __DIR__ . '/..' . '/firebase/php-jwt/src/BeforeValidException.php',
|
||||
'Firebase\\JWT\\ExpiredException' => __DIR__ . '/..' . '/firebase/php-jwt/src/ExpiredException.php',
|
||||
'Firebase\\JWT\\JWT' => __DIR__ . '/..' . '/firebase/php-jwt/src/JWT.php',
|
||||
'Firebase\\JWT\\SignatureInvalidException' => __DIR__ . '/..' . '/firebase/php-jwt/src/SignatureInvalidException.php',
|
||||
'OneLogin\\Saml2\\Auth' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Auth.php',
|
||||
'OneLogin\\Saml2\\AuthnRequest' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/AuthnRequest.php',
|
||||
'OneLogin\\Saml2\\Constants' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Constants.php',
|
||||
'OneLogin\\Saml2\\Error' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Error.php',
|
||||
'OneLogin\\Saml2\\IdPMetadataParser' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/IdPMetadataParser.php',
|
||||
'OneLogin\\Saml2\\LogoutRequest' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/LogoutRequest.php',
|
||||
'OneLogin\\Saml2\\LogoutResponse' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/LogoutResponse.php',
|
||||
'OneLogin\\Saml2\\Metadata' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Metadata.php',
|
||||
'OneLogin\\Saml2\\Response' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Response.php',
|
||||
'OneLogin\\Saml2\\Settings' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Settings.php',
|
||||
'OneLogin\\Saml2\\Utils' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/Utils.php',
|
||||
'OneLogin\\Saml2\\ValidationError' => __DIR__ . '/..' . '/onelogin/php-saml/src/Saml2/ValidationError.php',
|
||||
'RobRichards\\XMLSecLibs\\Utils\\XPath' => __DIR__ . '/..' . '/robrichards/xmlseclibs/src/Utils/XPath.php',
|
||||
'RobRichards\\XMLSecLibs\\XMLSecEnc' => __DIR__ . '/..' . '/robrichards/xmlseclibs/src/XMLSecEnc.php',
|
||||
'RobRichards\\XMLSecLibs\\XMLSecurityDSig' => __DIR__ . '/..' . '/robrichards/xmlseclibs/src/XMLSecurityDSig.php',
|
||||
'RobRichards\\XMLSecLibs\\XMLSecurityKey' => __DIR__ . '/..' . '/robrichards/xmlseclibs/src/XMLSecurityKey.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitcc75f134f7630c1ee3a8e4d7c86f3bcc::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitcc75f134f7630c1ee3a8e4d7c86f3bcc::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitcc75f134f7630c1ee3a8e4d7c86f3bcc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "firebase/php-jwt",
|
||||
"version": "v4.0.0",
|
||||
"version_normalized": "4.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/firebase/php-jwt.git",
|
||||
"reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/dccf163dc8ed7ed6a00afc06c51ee5186a428d35",
|
||||
"reference": "dccf163dc8ed7ed6a00afc06c51ee5186a428d35",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2016-07-18T04:51:16+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Firebase\\JWT\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Neuman Vong",
|
||||
"email": "neuman+pear@twilio.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Anant Narayanan",
|
||||
"email": "anant@php.net",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
||||
"homepage": "https://github.com/firebase/php-jwt",
|
||||
"install-path": "../firebase/php-jwt"
|
||||
},
|
||||
{
|
||||
"name": "onelogin/php-saml",
|
||||
"version": "3.4.1",
|
||||
"version_normalized": "3.4.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/onelogin/php-saml.git",
|
||||
"reference": "5fbf3486704ac9835b68184023ab54862c95f213"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/onelogin/php-saml/zipball/5fbf3486704ac9835b68184023ab54862c95f213",
|
||||
"reference": "5fbf3486704ac9835b68184023ab54862c95f213",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"robrichards/xmlseclibs": ">=3.0.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"pdepend/pdepend": "^2.5.0",
|
||||
"php-coveralls/php-coveralls": "^1.0.2 || ^2.0",
|
||||
"phploc/phploc": "^2.1 || ^3.0 || ^4.0",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1",
|
||||
"sebastian/phpcpd": "^2.0 || ^3.0 || ^4.0",
|
||||
"squizlabs/php_codesniffer": "^3.1.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs",
|
||||
"ext-gettext": "Install gettext and php5-gettext libs to handle translations",
|
||||
"ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)"
|
||||
},
|
||||
"time": "2019-11-25T17:30:07+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OneLogin\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "OneLogin PHP SAML Toolkit",
|
||||
"homepage": "https://developers.onelogin.com/saml/php",
|
||||
"keywords": [
|
||||
"SAML2",
|
||||
"onelogin",
|
||||
"saml"
|
||||
],
|
||||
"install-path": "../onelogin/php-saml"
|
||||
},
|
||||
{
|
||||
"name": "robrichards/xmlseclibs",
|
||||
"version": "3.1.1",
|
||||
"version_normalized": "3.1.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/robrichards/xmlseclibs.git",
|
||||
"reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/f8f19e58f26cdb42c54b214ff8a820760292f8df",
|
||||
"reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-openssl": "*",
|
||||
"php": ">= 5.4"
|
||||
},
|
||||
"time": "2020-09-05T13:00:25+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RobRichards\\XMLSecLibs\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "A PHP library for XML Security",
|
||||
"homepage": "https://github.com/robrichards/xmlseclibs",
|
||||
"keywords": [
|
||||
"security",
|
||||
"signature",
|
||||
"xml",
|
||||
"xmldsig"
|
||||
],
|
||||
"install-path": "../robrichards/xmlseclibs"
|
||||
}
|
||||
],
|
||||
"dev": false,
|
||||
"dev-package-names": []
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
<?php return array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '4e74fb44d08ff9e669c4a44db697badf8bdf2996',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '4e74fb44d08ff9e669c4a44db697badf8bdf2996',
|
||||
),
|
||||
'firebase/php-jwt' =>
|
||||
array (
|
||||
'pretty_version' => 'v4.0.0',
|
||||
'version' => '4.0.0.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'dccf163dc8ed7ed6a00afc06c51ee5186a428d35',
|
||||
),
|
||||
'onelogin/php-saml' =>
|
||||
array (
|
||||
'pretty_version' => '3.4.1',
|
||||
'version' => '3.4.1.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => '5fbf3486704ac9835b68184023ab54862c95f213',
|
||||
),
|
||||
'robrichards/xmlseclibs' =>
|
||||
array (
|
||||
'pretty_version' => '3.1.1',
|
||||
'version' => '3.1.1.0',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'f8f19e58f26cdb42c54b214ff8a820760292f8df',
|
||||
),
|
||||
),
|
||||
);
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 50400)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.4.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
Copyright (c) 2011, Neuman Vong
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the name of Neuman Vong nor the names of other
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,119 +0,0 @@
|
|||
[](https://travis-ci.org/firebase/php-jwt)
|
||||
[](https://packagist.org/packages/firebase/php-jwt)
|
||||
[](https://packagist.org/packages/firebase/php-jwt)
|
||||
[](https://packagist.org/packages/firebase/php-jwt)
|
||||
|
||||
PHP-JWT
|
||||
=======
|
||||
A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to [RFC 7519](https://tools.ietf.org/html/rfc7519).
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Use composer to manage your dependencies and download PHP-JWT:
|
||||
|
||||
```bash
|
||||
composer require firebase/php-jwt
|
||||
```
|
||||
|
||||
Example
|
||||
-------
|
||||
```php
|
||||
<?php
|
||||
use \Firebase\JWT\JWT;
|
||||
|
||||
$key = "example_key";
|
||||
$token = array(
|
||||
"iss" => "http://example.org",
|
||||
"aud" => "http://example.com",
|
||||
"iat" => 1356999524,
|
||||
"nbf" => 1357000000
|
||||
);
|
||||
|
||||
/**
|
||||
* IMPORTANT:
|
||||
* You must specify supported algorithms for your application. See
|
||||
* https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
|
||||
* for a list of spec-compliant algorithms.
|
||||
*/
|
||||
$jwt = JWT::encode($token, $key);
|
||||
$decoded = JWT::decode($jwt, $key, array('HS256'));
|
||||
|
||||
print_r($decoded);
|
||||
|
||||
/*
|
||||
NOTE: This will now be an object instead of an associative array. To get
|
||||
an associative array, you will need to cast it as such:
|
||||
*/
|
||||
|
||||
$decoded_array = (array) $decoded;
|
||||
|
||||
/**
|
||||
* You can add a leeway to account for when there is a clock skew times between
|
||||
* the signing and verifying servers. It is recommended that this leeway should
|
||||
* not be bigger than a few minutes.
|
||||
*
|
||||
* Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
|
||||
*/
|
||||
JWT::$leeway = 60; // $leeway in seconds
|
||||
$decoded = JWT::decode($jwt, $key, array('HS256'));
|
||||
|
||||
?>
|
||||
```
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
#### 4.0.0 / 2016-07-17
|
||||
- Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)!
|
||||
- Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)!
|
||||
- Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)!
|
||||
- Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)!
|
||||
|
||||
#### 3.0.0 / 2015-07-22
|
||||
- Minimum PHP version updated from `5.2.0` to `5.3.0`.
|
||||
- Add `\Firebase\JWT` namespace. See
|
||||
[#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to
|
||||
[@Dashron](https://github.com/Dashron)!
|
||||
- Require a non-empty key to decode and verify a JWT. See
|
||||
[#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to
|
||||
[@sjones608](https://github.com/sjones608)!
|
||||
- Cleaner documentation blocks in the code. See
|
||||
[#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to
|
||||
[@johanderuijter](https://github.com/johanderuijter)!
|
||||
|
||||
#### 2.2.0 / 2015-06-22
|
||||
- Add support for adding custom, optional JWT headers to `JWT::encode()`. See
|
||||
[#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to
|
||||
[@mcocaro](https://github.com/mcocaro)!
|
||||
|
||||
#### 2.1.0 / 2015-05-20
|
||||
- Add support for adding a leeway to `JWT:decode()` that accounts for clock skew
|
||||
between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)!
|
||||
- Add support for passing an object implementing the `ArrayAccess` interface for
|
||||
`$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)!
|
||||
|
||||
#### 2.0.0 / 2015-04-01
|
||||
- **Note**: It is strongly recommended that you update to > v2.0.0 to address
|
||||
known security vulnerabilities in prior versions when both symmetric and
|
||||
asymmetric keys are used together.
|
||||
- Update signature for `JWT::decode(...)` to require an array of supported
|
||||
algorithms to use when verifying token signatures.
|
||||
|
||||
|
||||
Tests
|
||||
-----
|
||||
Run the tests using phpunit:
|
||||
|
||||
```bash
|
||||
$ pear install PHPUnit
|
||||
$ phpunit --configuration phpunit.xml.dist
|
||||
PHPUnit 3.7.10 by Sebastian Bergmann.
|
||||
.....
|
||||
Time: 0 seconds, Memory: 2.50Mb
|
||||
OK (5 tests, 5 assertions)
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
[3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause).
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"name": "firebase/php-jwt",
|
||||
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
||||
"homepage": "https://github.com/firebase/php-jwt",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Neuman Vong",
|
||||
"email": "neuman+pear@twilio.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Anant Narayanan",
|
||||
"email": "anant@php.net",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Firebase\\JWT\\": "src"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
19
docker/nextcloud/custom_apps/user_saml/3rdparty/vendor/firebase/php-jwt/composer.lock
generated
vendored
19
docker/nextcloud/custom_apps/user_saml/3rdparty/vendor/firebase/php-jwt/composer.lock
generated
vendored
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "60a5df5d283a7ae9000173248eba8909",
|
||||
"packages": [],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.2.0"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<package packagerversion="1.9.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
||||
http://pear.php.net/dtd/tasks-1.0.xsd
|
||||
http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>JWT</name>
|
||||
<channel>pear.php.net</channel>
|
||||
<summary>A JWT encoder/decoder.</summary>
|
||||
<description>A JWT encoder/decoder library for PHP.</description>
|
||||
<lead>
|
||||
<name>Neuman Vong</name>
|
||||
<user>lcfrs</user>
|
||||
<email>neuman+pear@twilio.com</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<lead>
|
||||
<name>Firebase Operations</name>
|
||||
<user>firebase</user>
|
||||
<email>operations@firebase.com</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2015-07-22</date>
|
||||
<version>
|
||||
<release>3.0.0</release>
|
||||
<api>3.0.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license>
|
||||
<notes>
|
||||
Initial release with basic support for JWT encoding, decoding and signature verification.
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="/" name="/">
|
||||
<dir name="tests">
|
||||
<file name="JWTTest.php" role="test" />
|
||||
</dir>
|
||||
<file name="Authentication/JWT.php" role="php" />
|
||||
</dir>
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>5.1</min>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.7.0</min>
|
||||
</pearinstaller>
|
||||
<extension>
|
||||
<name>json</name>
|
||||
</extension>
|
||||
<extension>
|
||||
<name>hash</name>
|
||||
</extension>
|
||||
</required>
|
||||
</dependencies>
|
||||
<phprelease />
|
||||
<changelog>
|
||||
<release>
|
||||
<version>
|
||||
<release>0.1.0</release>
|
||||
<api>0.1.0</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
<api>beta</api>
|
||||
</stability>
|
||||
<date>2015-04-01</date>
|
||||
<license uri="http://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</license>
|
||||
<notes>
|
||||
Initial release with basic support for JWT encoding, decoding and signature verification.
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
</package>
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
namespace Firebase\JWT;
|
||||
|
||||
class BeforeValidException extends \UnexpectedValueException
|
||||
{
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
namespace Firebase\JWT;
|
||||
|
||||
class ExpiredException extends \UnexpectedValueException
|
||||
{
|
||||
|
||||
}
|
|
@ -1,370 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Firebase\JWT;
|
||||
use \DomainException;
|
||||
use \InvalidArgumentException;
|
||||
use \UnexpectedValueException;
|
||||
use \DateTime;
|
||||
|
||||
/**
|
||||
* JSON Web Token implementation, based on this spec:
|
||||
* http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Authentication
|
||||
* @package Authentication_JWT
|
||||
* @author Neuman Vong <neuman@twilio.com>
|
||||
* @author Anant Narayanan <anant@php.net>
|
||||
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
|
||||
* @link https://github.com/firebase/php-jwt
|
||||
*/
|
||||
class JWT
|
||||
{
|
||||
|
||||
/**
|
||||
* When checking nbf, iat or expiration times,
|
||||
* we want to provide some extra leeway time to
|
||||
* account for clock skew.
|
||||
*/
|
||||
public static $leeway = 0;
|
||||
|
||||
/**
|
||||
* Allow the current timestamp to be specified.
|
||||
* Useful for fixing a value within unit testing.
|
||||
*
|
||||
* Will default to PHP time() value if null.
|
||||
*/
|
||||
public static $timestamp = null;
|
||||
|
||||
public static $supported_algs = array(
|
||||
'HS256' => array('hash_hmac', 'SHA256'),
|
||||
'HS512' => array('hash_hmac', 'SHA512'),
|
||||
'HS384' => array('hash_hmac', 'SHA384'),
|
||||
'RS256' => array('openssl', 'SHA256'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Decodes a JWT string into a PHP object.
|
||||
*
|
||||
* @param string $jwt The JWT
|
||||
* @param string|array $key The key, or map of keys.
|
||||
* If the algorithm used is asymmetric, this is the public key
|
||||
* @param array $allowed_algs List of supported verification algorithms
|
||||
* Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'
|
||||
*
|
||||
* @return object The JWT's payload as a PHP object
|
||||
*
|
||||
* @throws UnexpectedValueException Provided JWT was invalid
|
||||
* @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed
|
||||
* @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf'
|
||||
* @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat'
|
||||
* @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim
|
||||
*
|
||||
* @uses jsonDecode
|
||||
* @uses urlsafeB64Decode
|
||||
*/
|
||||
public static function decode($jwt, $key, $allowed_algs = array())
|
||||
{
|
||||
$timestamp = is_null(static::$timestamp) ? time() : static::$timestamp;
|
||||
|
||||
if (empty($key)) {
|
||||
throw new InvalidArgumentException('Key may not be empty');
|
||||
}
|
||||
if (!is_array($allowed_algs)) {
|
||||
throw new InvalidArgumentException('Algorithm not allowed');
|
||||
}
|
||||
$tks = explode('.', $jwt);
|
||||
if (count($tks) != 3) {
|
||||
throw new UnexpectedValueException('Wrong number of segments');
|
||||
}
|
||||
list($headb64, $bodyb64, $cryptob64) = $tks;
|
||||
if (null === ($header = static::jsonDecode(static::urlsafeB64Decode($headb64)))) {
|
||||
throw new UnexpectedValueException('Invalid header encoding');
|
||||
}
|
||||
if (null === $payload = static::jsonDecode(static::urlsafeB64Decode($bodyb64))) {
|
||||
throw new UnexpectedValueException('Invalid claims encoding');
|
||||
}
|
||||
$sig = static::urlsafeB64Decode($cryptob64);
|
||||
|
||||
if (empty($header->alg)) {
|
||||
throw new UnexpectedValueException('Empty algorithm');
|
||||
}
|
||||
if (empty(static::$supported_algs[$header->alg])) {
|
||||
throw new UnexpectedValueException('Algorithm not supported');
|
||||
}
|
||||
if (!in_array($header->alg, $allowed_algs)) {
|
||||
throw new UnexpectedValueException('Algorithm not allowed');
|
||||
}
|
||||
if (is_array($key) || $key instanceof \ArrayAccess) {
|
||||
if (isset($header->kid)) {
|
||||
$key = $key[$header->kid];
|
||||
} else {
|
||||
throw new UnexpectedValueException('"kid" empty, unable to lookup correct key');
|
||||
}
|
||||
}
|
||||
|
||||
// Check the signature
|
||||
if (!static::verify("$headb64.$bodyb64", $sig, $key, $header->alg)) {
|
||||
throw new SignatureInvalidException('Signature verification failed');
|
||||
}
|
||||
|
||||
// Check if the nbf if it is defined. This is the time that the
|
||||
// token can actually be used. If it's not yet that time, abort.
|
||||
if (isset($payload->nbf) && $payload->nbf > ($timestamp + static::$leeway)) {
|
||||
throw new BeforeValidException(
|
||||
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->nbf)
|
||||
);
|
||||
}
|
||||
|
||||
// Check that this token has been created before 'now'. This prevents
|
||||
// using tokens that have been created for later use (and haven't
|
||||
// correctly used the nbf claim).
|
||||
if (isset($payload->iat) && $payload->iat > ($timestamp + static::$leeway)) {
|
||||
throw new BeforeValidException(
|
||||
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->iat)
|
||||
);
|
||||
}
|
||||
|
||||
// Check if this token has expired.
|
||||
if (isset($payload->exp) && ($timestamp - static::$leeway) >= $payload->exp) {
|
||||
throw new ExpiredException('Expired token');
|
||||
}
|
||||
|
||||
return $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts and signs a PHP object or array into a JWT string.
|
||||
*
|
||||
* @param object|array $payload PHP object or array
|
||||
* @param string $key The secret key.
|
||||
* If the algorithm used is asymmetric, this is the private key
|
||||
* @param string $alg The signing algorithm.
|
||||
* Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'
|
||||
* @param mixed $keyId
|
||||
* @param array $head An array with header elements to attach
|
||||
*
|
||||
* @return string A signed JWT
|
||||
*
|
||||
* @uses jsonEncode
|
||||
* @uses urlsafeB64Encode
|
||||
*/
|
||||
public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null)
|
||||
{
|
||||
$header = array('typ' => 'JWT', 'alg' => $alg);
|
||||
if ($keyId !== null) {
|
||||
$header['kid'] = $keyId;
|
||||
}
|
||||
if ( isset($head) && is_array($head) ) {
|
||||
$header = array_merge($head, $header);
|
||||
}
|
||||
$segments = array();
|
||||
$segments[] = static::urlsafeB64Encode(static::jsonEncode($header));
|
||||
$segments[] = static::urlsafeB64Encode(static::jsonEncode($payload));
|
||||
$signing_input = implode('.', $segments);
|
||||
|
||||
$signature = static::sign($signing_input, $key, $alg);
|
||||
$segments[] = static::urlsafeB64Encode($signature);
|
||||
|
||||
return implode('.', $segments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign a string with a given key and algorithm.
|
||||
*
|
||||
* @param string $msg The message to sign
|
||||
* @param string|resource $key The secret key
|
||||
* @param string $alg The signing algorithm.
|
||||
* Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'
|
||||
*
|
||||
* @return string An encrypted message
|
||||
*
|
||||
* @throws DomainException Unsupported algorithm was specified
|
||||
*/
|
||||
public static function sign($msg, $key, $alg = 'HS256')
|
||||
{
|
||||
if (empty(static::$supported_algs[$alg])) {
|
||||
throw new DomainException('Algorithm not supported');
|
||||
}
|
||||
list($function, $algorithm) = static::$supported_algs[$alg];
|
||||
switch($function) {
|
||||
case 'hash_hmac':
|
||||
return hash_hmac($algorithm, $msg, $key, true);
|
||||
case 'openssl':
|
||||
$signature = '';
|
||||
$success = openssl_sign($msg, $signature, $key, $algorithm);
|
||||
if (!$success) {
|
||||
throw new DomainException("OpenSSL unable to sign data");
|
||||
} else {
|
||||
return $signature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify a signature with the message, key and method. Not all methods
|
||||
* are symmetric, so we must have a separate verify and sign method.
|
||||
*
|
||||
* @param string $msg The original message (header and body)
|
||||
* @param string $signature The original signature
|
||||
* @param string|resource $key For HS*, a string key works. for RS*, must be a resource of an openssl public key
|
||||
* @param string $alg The algorithm
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws DomainException Invalid Algorithm or OpenSSL failure
|
||||
*/
|
||||
private static function verify($msg, $signature, $key, $alg)
|
||||
{
|
||||
if (empty(static::$supported_algs[$alg])) {
|
||||
throw new DomainException('Algorithm not supported');
|
||||
}
|
||||
|
||||
list($function, $algorithm) = static::$supported_algs[$alg];
|
||||
switch($function) {
|
||||
case 'openssl':
|
||||
$success = openssl_verify($msg, $signature, $key, $algorithm);
|
||||
if (!$success) {
|
||||
throw new DomainException("OpenSSL unable to verify data: " . openssl_error_string());
|
||||
} else {
|
||||
return $signature;
|
||||
}
|
||||
case 'hash_hmac':
|
||||
default:
|
||||
$hash = hash_hmac($algorithm, $msg, $key, true);
|
||||
if (function_exists('hash_equals')) {
|
||||
return hash_equals($signature, $hash);
|
||||
}
|
||||
$len = min(static::safeStrlen($signature), static::safeStrlen($hash));
|
||||
|
||||
$status = 0;
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$status |= (ord($signature[$i]) ^ ord($hash[$i]));
|
||||
}
|
||||
$status |= (static::safeStrlen($signature) ^ static::safeStrlen($hash));
|
||||
|
||||
return ($status === 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a JSON string into a PHP object.
|
||||
*
|
||||
* @param string $input JSON string
|
||||
*
|
||||
* @return object Object representation of JSON string
|
||||
*
|
||||
* @throws DomainException Provided string was invalid JSON
|
||||
*/
|
||||
public static function jsonDecode($input)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
||||
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
|
||||
* to specify that large ints (like Steam Transaction IDs) should be treated as
|
||||
* strings, rather than the PHP default behaviour of converting them to floats.
|
||||
*/
|
||||
$obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
|
||||
} else {
|
||||
/** Not all servers will support that, however, so for older versions we must
|
||||
* manually detect large ints in the JSON string and quote them (thus converting
|
||||
*them to strings) before decoding, hence the preg_replace() call.
|
||||
*/
|
||||
$max_int_length = strlen((string) PHP_INT_MAX) - 1;
|
||||
$json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
|
||||
$obj = json_decode($json_without_bigints);
|
||||
}
|
||||
|
||||
if (function_exists('json_last_error') && $errno = json_last_error()) {
|
||||
static::handleJsonError($errno);
|
||||
} elseif ($obj === null && $input !== 'null') {
|
||||
throw new DomainException('Null result with non-null input');
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a PHP object into a JSON string.
|
||||
*
|
||||
* @param object|array $input A PHP object or array
|
||||
*
|
||||
* @return string JSON representation of the PHP object or array
|
||||
*
|
||||
* @throws DomainException Provided object could not be encoded to valid JSON
|
||||
*/
|
||||
public static function jsonEncode($input)
|
||||
{
|
||||
$json = json_encode($input);
|
||||
if (function_exists('json_last_error') && $errno = json_last_error()) {
|
||||
static::handleJsonError($errno);
|
||||
} elseif ($json === 'null' && $input !== null) {
|
||||
throw new DomainException('Null result with non-null input');
|
||||
}
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a string with URL-safe Base64.
|
||||
*
|
||||
* @param string $input A Base64 encoded string
|
||||
*
|
||||
* @return string A decoded string
|
||||
*/
|
||||
public static function urlsafeB64Decode($input)
|
||||
{
|
||||
$remainder = strlen($input) % 4;
|
||||
if ($remainder) {
|
||||
$padlen = 4 - $remainder;
|
||||
$input .= str_repeat('=', $padlen);
|
||||
}
|
||||
return base64_decode(strtr($input, '-_', '+/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a string with URL-safe Base64.
|
||||
*
|
||||
* @param string $input The string you want encoded
|
||||
*
|
||||
* @return string The base64 encode of what you passed in
|
||||
*/
|
||||
public static function urlsafeB64Encode($input)
|
||||
{
|
||||
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a JSON error.
|
||||
*
|
||||
* @param int $errno An error number from json_last_error()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function handleJsonError($errno)
|
||||
{
|
||||
$messages = array(
|
||||
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
|
||||
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
|
||||
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
|
||||
);
|
||||
throw new DomainException(
|
||||
isset($messages[$errno])
|
||||
? $messages[$errno]
|
||||
: 'Unknown JSON error: ' . $errno
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes in cryptographic strings.
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private static function safeStrlen($str)
|
||||
{
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($str, '8bit');
|
||||
}
|
||||
return strlen($str);
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
namespace Firebase\JWT;
|
||||
|
||||
class SignatureInvalidException extends \UnexpectedValueException
|
||||
{
|
||||
|
||||
}
|
|
@ -1,296 +0,0 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
v3.4.1
|
||||
* Add setSchemasPath to Auth class and fix backward compatibility
|
||||
|
||||
v.3.4.0
|
||||
* Support rejecting unsolicited SAMLResponses.
|
||||
* Support stric destination matching.
|
||||
* Reject SAMLResponse if requestID was provided to the validotr but the InResponseTo attributeof the SAMLResponse is missing
|
||||
* Check destination against the getSelfURLNoQuery as well on LogoutRequest and LogoutResponse as we do on Response
|
||||
* Improve getSelfRoutedURLNoQuery method
|
||||
* Only add responseUrl to the settings if ResponseLocation present in the IdPMetadataParser
|
||||
* Remove use of $_GET on static method validateBinarySign
|
||||
* Fix error message when Assertion and NameId are both encrypted (not supported)
|
||||
|
||||
v.3.3.1
|
||||
* Update xmlseclibs to 3.0.4
|
||||
* Remove Comparison atribute from RequestedAuthnContext when setting has empty value
|
||||
|
||||
v.3.3.0
|
||||
* Set true as the default value for strict setting
|
||||
* Relax comparision of false on SignMetadata
|
||||
* Fix CI
|
||||
|
||||
v.3.2.1
|
||||
* Add missed nameIdValueReq parameter to buildAuthnRequest method
|
||||
|
||||
v.3.2.0
|
||||
* Add support for Subjects on AuthNRequests by the new parameter nameIdValueReq
|
||||
* Support SLO ResponseLocation
|
||||
* [#344](https://github.com/onelogin/php-saml/issues/344) Raise errors on IdPMetadataParser::parseRemoteXML and IdPMetadataParser::parseFileXML
|
||||
* [#356](https://github.com/onelogin/php-saml/issues/356) Support 'x509cert' and 'privateKey' on signMetadata security setting
|
||||
|
||||
v.3.1.1
|
||||
* Force to use at least xmlseclibs 3.0.3 for security reasons
|
||||
* [#367](https://github.com/onelogin/php-saml/pull/367) Move the creation of the AuthnRequest to separate function
|
||||
* Set strict=true on config examples
|
||||
* Move phpunit.xml
|
||||
|
||||
v.3.1.0
|
||||
* Security improvement suggested by Nils Engelbertz to prevent DDOS by expansion of internally defined entities (XEE)
|
||||
* Fix setting_example.php servicename parameter
|
||||
|
||||
v.3.0.0
|
||||
* Remove mcrypt dependency. Compatible with PHP 7.2
|
||||
* xmlseclibs now is not part of the toolkit and need to be installed from original source
|
||||
|
||||
v.2.18.0
|
||||
* Support rejecting unsolicited SAMLResponses.
|
||||
* Support stric destination matching.
|
||||
* Reject SAMLResponse if requestID was provided to the validotr but the InResponseTo attributeof the SAMLResponse is missing
|
||||
* Check destination against the getSelfURLNoQuery as well on LogoutRequest and LogoutResponse as we do on Response
|
||||
* Improve getSelfRoutedURLNoQuery method
|
||||
* Only add responseUrl to the settings if ResponseLocation present in the IdPMetadataParser
|
||||
* Remove use of $_GET on static method validateBinarySign
|
||||
* Fix error message when Assertion and NameId are both encrypted (not supported)
|
||||
|
||||
v.2.17.1
|
||||
* Update xmlseclibs to 3.0.4
|
||||
* Remove Comparison atribute from RequestedAuthnContext when setting has empty value
|
||||
|
||||
v.2.17.0
|
||||
* Set true as the default value for strict setting
|
||||
* Support 'x509cert' and 'privateKey' on signMetadata security settings
|
||||
* Relax comparision of false on SignMetadata
|
||||
* Fix CI
|
||||
|
||||
v.2.16.0
|
||||
* Support SLO ResponseLocation
|
||||
* [#344](https://github.com/onelogin/php-saml/issues/344) Raise errors on IdPMetadataParser::parseRemoteXML and IdPMetadataParser::parseFileXML
|
||||
* Adjusted acs endpoint to extract NameQualifier and SPNameQualifier from SAMLResponse. Adjusted single logout service to provide NameQualifier and SPNameQualifier to logout method. Add getNameIdNameQualifier to Auth and SamlResponse. Extend logout method from Auth and LogoutRequest constructor to support SPNameQualifier parameter. Align LogoutRequest constructor with SAML specs
|
||||
* Add support for Subjects on AuthNRequests by the new parameter
|
||||
* Set strict=true on config examples
|
||||
|
||||
v.2.15.0
|
||||
* Security improvement suggested by Nils Engelbertz to prevent DDOS by expansion of internally defined entities (XEE)
|
||||
* Fix bug on settings_example.php
|
||||
|
||||
v.2.14.0
|
||||
* Add parameter to the decryptElement method to make optional the formatting
|
||||
* [#283](https://github.com/onelogin/php-saml/pull/283) New method of importing a decrypted assertion into the XML document to replace the EncryptedAssertion. Fix signature issues on Signed Encrypted Assertions with default namespace
|
||||
* Allow the getSPMetadata() method to always include the encryption Key Descriptor
|
||||
* Change some Fatal Error to Exceptions
|
||||
* [#265](https://github.com/onelogin/php-saml/issues/265) Support parameters at getSPMetadata method
|
||||
* Avoid calling static method using this
|
||||
|
||||
v.2.13.0
|
||||
* Update xmlseclibs with some fixes.
|
||||
* Add extra protection verifying the Signature algorithm used on SignedInfo element, not only rely on the xmlseclibs verify / verifySignature methods.
|
||||
* Add getAttributesWithFriendlyName method which returns the set of SAML attributes indexed by FriendlyName
|
||||
* Fix bug on parseRemoteXML and parseFileXML. Internal calls to parseXML missed the desiredNameIdFormat parameter
|
||||
|
||||
v.2.12.0
|
||||
* Improve Time management. Use DateTime/DateTimeZone classes.
|
||||
* Escape error messages in debug mode
|
||||
* Improve phpdoc
|
||||
* Add an extra filter to the url to be used on redirection
|
||||
|
||||
* [#242](https://github.com/onelogin/php-saml/pull/242) Document that SHA-1 must not be used
|
||||
* [#250](https://github.com/onelogin/php-saml/pull/250) Fixed issue with IdPMetadataParser only keeping 1 certificate when multiple certificates of a single type were provided.
|
||||
* [#263](https://github.com/onelogin/php-saml/issues/263) Fix incompatibility with ADFS on SLO. When on php saml settings NameID Format is set as unspecified but the SAMLResponse has no NameID Format, no NameID Format should be specified on LogoutRequest.
|
||||
|
||||
v.2.11.0
|
||||
* [#236](https://github.com/onelogin/php-saml/pull/236) Exclude unnecesary files from Composer production downloads
|
||||
* [#226](https://github.com/onelogin/php-saml/pull/226) Add possibility to handle nameId NameQualifier attribute in SLO Request
|
||||
* Improve logout documentation on Readme.
|
||||
* Improve multi-certificate support
|
||||
|
||||
v.2.10.7
|
||||
* Fix IdPMetadataParser. The SingleLogoutService retrieved method was wrong
|
||||
* [#201](https://github.com/onelogin/php-saml/issues/201) Fix issues with SP entity_id, acs url and sls url that contains &
|
||||
|
||||
v.2.10.6
|
||||
* [#206](https://github.com/onelogin/php-saml/pull/206)Be able to register future SP x509cert on the settings and publish it on SP metadata
|
||||
* [#206](https://github.com/onelogin/php-saml/pull/206) Be able to register more than 1 Identity Provider x509cert, linked with an specific use (signing or encryption)
|
||||
* [#206](https://github.com/onelogin/php-saml/pull/206) Support the ability to parse IdP XML metadata (remote url or file) and be able to inject the data obtained on the settings.
|
||||
|
||||
v.2.10.5
|
||||
* Be able to get at the auth object the last processed ID
|
||||
* Improve NameID Format support
|
||||
* Reset errorReason attribute of the auth object after each Process method
|
||||
* Validate serial number as string to work around libxml2 limitation
|
||||
* Make the Issuer on the Response Optional
|
||||
|
||||
v.2.10.4
|
||||
* [+](https://github.com/onelogin/php-saml/commit/949359f5cad5e1d085c4e5447d9aa8f49a6e82a1) Security update for signature validation on LogoutRequest/LogoutResponse
|
||||
* [#192](https://github.com/onelogin/php-saml/pull/192) Added ability to configure DigestAlgorithm in settings
|
||||
* [#183](https://github.com/onelogin/php-saml/pull/183) Fix strpos bug when decrypting assertions
|
||||
* [#186](https://github.com/onelogin/php-saml/pull/186) Improve info on entityId validation Exception
|
||||
* [#188](https://github.com/onelogin/php-saml/pull/188) Fixed issue with undefined constant of UNEXPECTED_SIGNED_ELEMENT
|
||||
* Read ACS binding on AuthNRequest builder from settings
|
||||
* Be able to relax Destination validation on SAMLResponses and let this
|
||||
attribute to be empty with the 'relaxDestinationValidation' setting
|
||||
|
||||
v.2.10.3
|
||||
* Implement a more specific exception class for handling some validation errors
|
||||
* Minor changes on time validation/exceptions
|
||||
* Add hooks to retrieve last-sent and last-received requests and responses
|
||||
* Improve/Fix tests
|
||||
* Add DigestAlgorithm support on addSign
|
||||
* [#177](https://github.com/onelogin/php-saml/pull/177) Add error message for bad OneLogin_Saml2_Settings argument
|
||||
|
||||
v.2.10.2
|
||||
* [#175](https://github.com/onelogin/php-saml/pull/175) Allow overriding of host, port, protocol and url path for URL building
|
||||
* [#173](https://github.com/onelogin/php-saml/pull/173) Provide better support to NameIdFormat
|
||||
* Fix another issue on Assertion Signature validation when the assertion contains no namespace, container has saml2 namespace and it was encrypted
|
||||
|
||||
v.2.10.1
|
||||
* Fix error message on SignMetadata process
|
||||
* Fix issue on Assertion Signature validation when the assertion contains no namespace and it was encrypted
|
||||
|
||||
v.2.10.0
|
||||
* Several security improvements:
|
||||
* Conditions element required and unique.
|
||||
* AuthnStatement element required and unique.
|
||||
* SPNameQualifier must math the SP EntityID
|
||||
* Reject saml:Attribute element with same “Name” attribute
|
||||
* Reject empty nameID
|
||||
* Require Issuer element. (Must match IdP EntityID).
|
||||
* Destination value can't be blank (if present must match ACS URL).
|
||||
* Check that the EncryptedAssertion element only contains 1 Assertion element.
|
||||
* Improve Signature validation process
|
||||
* AttributeConsumingService support
|
||||
* Support lowercase Urlencoding (ADFS compatibility).
|
||||
* [#154](https://github.com/onelogin/php-saml/pull/154) getSelfHost no longer returns a port number
|
||||
* [#156](https://github.com/onelogin/php-saml/pull/156) Use correct host on response destination fallback check
|
||||
* [#158](https://github.com/onelogin/php-saml/pull/158) NEW Control usage of X-Forwarded-* headers
|
||||
* Fix issue with buildRequestSignature. Added RelayState to the SignQuery only if is not null.
|
||||
* Add Signature Wrapping prevention Test
|
||||
* Improve _decryptAssertion in order to take care of Assertions with problems with namespaces
|
||||
* Improve documentation
|
||||
|
||||
v.2.9.1
|
||||
.......
|
||||
* [134](https://github.com/onelogin/php-saml/pull/134) PHP7 production settings compiles out assert(), throw an exception explicitly
|
||||
* [132](https://github.com/onelogin/php-saml/pull/132) Add note for "wantAssertionsEncrypted"
|
||||
* Update copyright on LICENSE
|
||||
|
||||
v.2.9.0
|
||||
-------
|
||||
* Change the decrypt assertion process.
|
||||
* Add 2 extra validations to prevent Signature wrapping attacks.
|
||||
* Remove reference to wrong NameIDFormat: urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified should be urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
|
||||
* [128](https://github.com/onelogin/php-saml/pull/128) Test php7 and upgrade phpunit
|
||||
* Update Readme with more descriptive requestedAuthnContext description and Security Guidelines
|
||||
|
||||
v.2.8.0
|
||||
-------
|
||||
* Make NameIDPolicy of AuthNRequest optional
|
||||
* Make nameID requirement on SAMLResponse optional
|
||||
* Fix empty URI support
|
||||
* Symmetric encryption key support
|
||||
* Add more Auth Context options to the constant class
|
||||
* Fix DSA_SHA1 constant on xmlseclibs
|
||||
* Set none requestedAuthnContext as default behaviour
|
||||
* Update xmlseclibs lib
|
||||
* Improve formatPrivateKey method
|
||||
* Fix bug when signing metadata, the SignatureMethod was not provided
|
||||
* Fix getter for lastRequestID parameter in OneLogin_Saml2_Auth class
|
||||
* Add $wantEncrypted parameter on addX509KeyDescriptors method that will allow to set KeyDescriptor[use='encryption'] if wantNameIdEncrypted or wantAssertionsEncrypted enabled
|
||||
* Add $stay parameter on redirectTo method. (login/logout supports $stay but I forgot add this on previous 2.7.0 version)
|
||||
* Improve code style
|
||||
|
||||
v.2.7.0
|
||||
-------
|
||||
* Trim acs, slo and issuer urls.
|
||||
* Fix PHP 7 error (used continue outside a loop/switch).
|
||||
* Fix bug on organization element of the SP metadata builder.
|
||||
* Fix typos on documentation. Fix ALOWED Misspell.
|
||||
* Be able to extract RequestID. Add RequestID validation on demo1.
|
||||
* Add $stay parameter to login, logout and processSLO method.
|
||||
|
||||
v.2.6.1
|
||||
-------
|
||||
* Fix bug on cacheDuration of the Metadata XML generated.
|
||||
* Make SPNameQualifier optional on the generateNameId method. Avoid the use of SPNameQualifier when generating the NameID on the LogoutRequest builder.
|
||||
* Allows the authn comparsion attribute to be set via config.
|
||||
* Retrieve Session Timeout after processResponse with getSessionExpiration().
|
||||
* Improve readme readability.
|
||||
* Allow single log out to work for applications not leveraging php session_start. Added a callback parameter in order to close the session at processSLO.
|
||||
|
||||
v.2.6.0
|
||||
-------
|
||||
* Set NAMEID_UNSPECIFIED as default NameIDFormat to prevent conflicts with IdPs that don't support NAMEID_PERSISTENT.
|
||||
* Now the SP is able to select the algorithm to be used on signatures (DSA_SHA1, RSA_SHA1, RSA_SHA256, RSA_SHA384, RSA_SHA512).
|
||||
* Change visibility of _decryptAssertion to protected.
|
||||
* Update xmlseclibs library.
|
||||
* Handle valid but uncommon dsig block with no URI in the reference.
|
||||
* login, logout and processSLO now return ->redirectTo instead of just call it.
|
||||
* Split the setting check methods. Now 1 method for IdP settings and other for SP settings.
|
||||
* Let the setting object to avoid the IdP setting check. required if we want to publish SP SAML Metadata when the IdP data is still not provided.
|
||||
|
||||
v.2.5.0
|
||||
-------
|
||||
* Do accesible the ID of the object Logout Request (id attribute).
|
||||
* Add note about the fact that PHP 5.3 is unssuported.
|
||||
* Add fingerprint algorithm support.
|
||||
* Add dependences to composer.
|
||||
|
||||
v.2.4.0
|
||||
-------
|
||||
* Fix wrong element order in generated metadata.
|
||||
* Added SLO with nameID and SessionIndex in demo1.
|
||||
* Improve isHTTPS method in order to support HTTP_X_FORWARDED_PORT.
|
||||
* Set optional the XMLvalidation (enable/disable it with wantXMLValidation security setting).
|
||||
|
||||
v.2.3.0
|
||||
-------
|
||||
* Resolve namespace problem. Some IdPs uses saml2p:Response and saml2:Assertion instead of samlp:Response saml:Assertion.
|
||||
* Improve test and documentation.
|
||||
* Improve ADFS compatibility.
|
||||
* Remove unnecessary XSDs files.
|
||||
* Make available the reason for the saml message invalidation.
|
||||
* Adding ability to set idp cert once the Setting object initialized.
|
||||
* Fix status info issue.
|
||||
* Reject SAML Response if not signed and strict = false.
|
||||
* Support NameId and SessionIndex in LogoutRequest.
|
||||
* Add ForceAuh and IsPassive support.
|
||||
|
||||
v.2.2.0
|
||||
-------
|
||||
* Fix bug with Encrypted nameID on LogoutRequest.
|
||||
* Fixed usability bug. SP will inform about AuthFail status after process a Response.
|
||||
* Added SessionIndex support on LogoutRequest, and know is accesible from the Auth class.
|
||||
* LogoutRequest and LogoutResponse classes now accept non deflated xml.
|
||||
* Improved the XML metadata/ Decrypted Assertion output. (prettyprint).
|
||||
* Fix bug in formatPrivateKey method, the key could be not RSA.
|
||||
* Explicit warning message for signed element problem.
|
||||
* Decrypt method improved.
|
||||
* Support more algorithm at the SigAlg in the Signed LogoutRequests and LogoutResponses
|
||||
* AuthNRequest now stores ID (it can be retrieved later).
|
||||
* Fixed a typo on the 'NameIdPolicy' attribute that appeared at the README and settings_example file.
|
||||
|
||||
|
||||
v.2.1.0
|
||||
-------
|
||||
|
||||
* The isValid method of the Logout Request is now non-static. (affects processSLO method of Auth.php).
|
||||
* Logout Request constructor now accepts encoded logout requests.
|
||||
* Now after validate a message, if fails a method getError of the object will return the cause.
|
||||
* Fix typos.
|
||||
* Added extra parameters option to login and logout methods.
|
||||
* Improve Test (new test, use the new getError method for testing).
|
||||
* Bugfix namespace problem when getting Attributes.
|
||||
|
||||
|
||||
v.2.0.0
|
||||
-------
|
||||
|
||||
* New PHP SAML Toolkit (SLO, Sign, Encryptation).
|
||||
|
||||
|
||||
v.1.0.0
|
||||
-------
|
||||
|
||||
* Old PHP SAML Toolkit.
|
|
@ -1,23 +0,0 @@
|
|||
Copyright (c) 2010-2016 OneLogin, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Create an __autoload function
|
||||
// (can conflicts other autoloaders)
|
||||
// http://php.net/manual/en/language.oop5.autoload.php
|
||||
|
||||
// Load composer vendor folder if any
|
||||
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
/*
|
||||
// Load xmlseclibs
|
||||
|
||||
$xmlseclibsSrcDir = '';
|
||||
|
||||
include_once $xmlseclibsSrcDir.'/XMLSecEnc.php';
|
||||
include_once $xmlseclibsSrcDir.'/XMLSecurityDSig.php';
|
||||
include_once $xmlseclibsSrcDir.'/XMLSecurityKey.php';
|
||||
include_once $xmlseclibsSrcDir.'/Utils/XPath.php';
|
||||
*/
|
||||
|
||||
|
||||
// Load php-saml
|
||||
$libDir = __DIR__ . '/src/Saml2/';
|
||||
|
||||
$folderInfo = scandir($libDir);
|
||||
|
||||
foreach ($folderInfo as $element) {
|
||||
if (is_file($libDir.$element) && (substr($element, -4) === '.php')) {
|
||||
include_once $libDir.$element;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
<?php
|
||||
|
||||
$advancedSettings = array(
|
||||
|
||||
// Compression settings
|
||||
// Handle if the getRequest/getResponse methods will return the Request/Response deflated.
|
||||
// But if we provide a $deflate boolean parameter to the getRequest or getResponse
|
||||
// method it will have priority over the compression settings.
|
||||
'compress' => array(
|
||||
'requests' => true,
|
||||
'responses' => true
|
||||
),
|
||||
|
||||
// Security settings
|
||||
'security' => array(
|
||||
|
||||
/** signatures and encryptions offered */
|
||||
|
||||
// Indicates that the nameID of the <samlp:logoutRequest> sent by this SP
|
||||
// will be encrypted.
|
||||
'nameIdEncrypted' => false,
|
||||
|
||||
// Indicates whether the <samlp:AuthnRequest> messages sent by this SP
|
||||
// will be signed. [The Metadata of the SP will offer this info]
|
||||
'authnRequestsSigned' => false,
|
||||
|
||||
// Indicates whether the <samlp:logoutRequest> messages sent by this SP
|
||||
// will be signed.
|
||||
'logoutRequestSigned' => false,
|
||||
|
||||
// Indicates whether the <samlp:logoutResponse> messages sent by this SP
|
||||
// will be signed.
|
||||
'logoutResponseSigned' => false,
|
||||
|
||||
/* Sign the Metadata
|
||||
False || True (use sp certs) || array (
|
||||
'keyFileName' => 'metadata.key',
|
||||
'certFileName' => 'metadata.crt'
|
||||
)
|
||||
|| array (
|
||||
'x509cert' => '',
|
||||
'privateKey' => ''
|
||||
)
|
||||
*/
|
||||
'signMetadata' => false,
|
||||
|
||||
|
||||
/** signatures and encryptions required **/
|
||||
|
||||
// Indicates a requirement for the <samlp:Response>, <samlp:LogoutRequest> and
|
||||
// <samlp:LogoutResponse> elements received by this SP to be signed.
|
||||
'wantMessagesSigned' => false,
|
||||
|
||||
// Indicates a requirement for the <saml:Assertion> elements received by
|
||||
// this SP to be encrypted.
|
||||
'wantAssertionsEncrypted' => false,
|
||||
|
||||
// Indicates a requirement for the <saml:Assertion> elements received by
|
||||
// this SP to be signed. [The Metadata of the SP will offer this info]
|
||||
'wantAssertionsSigned' => false,
|
||||
|
||||
// Indicates a requirement for the NameID element on the SAMLResponse received
|
||||
// by this SP to be present.
|
||||
'wantNameId' => true,
|
||||
|
||||
// Indicates a requirement for the NameID received by
|
||||
// this SP to be encrypted.
|
||||
'wantNameIdEncrypted' => false,
|
||||
|
||||
// Authentication context.
|
||||
// Set to false and no AuthContext will be sent in the AuthNRequest,
|
||||
// Set true or don't present this parameter and you will get an AuthContext 'exact' 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
|
||||
// Set an array with the possible auth context values: array('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'),
|
||||
'requestedAuthnContext' => false,
|
||||
|
||||
// Allows the authn comparison parameter to be set, defaults to 'exact' if
|
||||
// the setting is not present.
|
||||
'requestedAuthnContextComparison' => 'exact',
|
||||
|
||||
// Indicates if the SP will validate all received xmls.
|
||||
// (In order to validate the xml, 'strict' and 'wantXMLValidation' must be true).
|
||||
'wantXMLValidation' => true,
|
||||
|
||||
// If true, SAMLResponses with an empty value at its Destination
|
||||
// attribute will not be rejected for this fact.
|
||||
'relaxDestinationValidation' => false,
|
||||
|
||||
// If true, Destination URL should strictly match to the address to
|
||||
// which the response has been sent.
|
||||
// Notice that if 'relaxDestinationValidation' is true an empty Destintation
|
||||
// will be accepted.
|
||||
'destinationStrictlyMatches' => false,
|
||||
|
||||
// If true, SAMLResponses with an InResponseTo value will be rejectd if not
|
||||
// AuthNRequest ID provided to the validation method.
|
||||
'rejectUnsolicitedResponsesWithInResponseTo' => false,
|
||||
|
||||
// Algorithm that the toolkit will use on signing process. Options:
|
||||
// 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
|
||||
// 'http://www.w3.org/2000/09/xmldsig#dsa-sha1'
|
||||
// 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
|
||||
// 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'
|
||||
// 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'
|
||||
// Notice that rsa-sha1 is a deprecated algorithm and should not be used
|
||||
'signatureAlgorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
|
||||
|
||||
// Algorithm that the toolkit will use on digest process. Options:
|
||||
// 'http://www.w3.org/2000/09/xmldsig#sha1'
|
||||
// 'http://www.w3.org/2001/04/xmlenc#sha256'
|
||||
// 'http://www.w3.org/2001/04/xmldsig-more#sha384'
|
||||
// 'http://www.w3.org/2001/04/xmlenc#sha512'
|
||||
// Notice that sha1 is a deprecated algorithm and should not be used
|
||||
'digestAlgorithm' => 'http://www.w3.org/2001/04/xmlenc#sha256',
|
||||
|
||||
// ADFS URL-Encodes SAML data as lowercase, and the toolkit by default uses
|
||||
// uppercase. Turn it True for ADFS compatibility on signature verification
|
||||
'lowercaseUrlencoding' => false,
|
||||
),
|
||||
|
||||
// Contact information template, it is recommended to suply a technical and support contacts
|
||||
'contactPerson' => array(
|
||||
'technical' => array(
|
||||
'givenName' => '',
|
||||
'emailAddress' => ''
|
||||
),
|
||||
'support' => array(
|
||||
'givenName' => '',
|
||||
'emailAddress' => ''
|
||||
),
|
||||
),
|
||||
|
||||
// Organization information template, the info in en_US lang is recomended, add more if required
|
||||
'organization' => array(
|
||||
'en-US' => array(
|
||||
'name' => '',
|
||||
'displayname' => '',
|
||||
'url' => ''
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/* Interoperable SAML 2.0 Web Browser SSO Profile [saml2int] http://saml2int.org/profile/current
|
||||
|
||||
'authnRequestsSigned' => false, // SP SHOULD NOT sign the <samlp:AuthnRequest>,
|
||||
// MUST NOT assume that the IdP validates the sign
|
||||
'wantAssertionsSigned' => true,
|
||||
'wantAssertionsEncrypted' => true, // MUST be enabled if SSL/HTTPs is disabled
|
||||
'wantNameIdEncrypted' => false,
|
||||
*/
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
"name": "onelogin/php-saml",
|
||||
"description": "OneLogin PHP SAML Toolkit",
|
||||
"license": "MIT",
|
||||
"homepage": "https://developers.onelogin.com/saml/php",
|
||||
"keywords": ["saml", "saml2", "onelogin"],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OneLogin\\": "src/"
|
||||
}
|
||||
},
|
||||
"support": {
|
||||
"email": "sixto.garcia@onelogin.com",
|
||||
"issues": "https://github.com/onelogin/php-saml/issues",
|
||||
"source": "https://github.com/onelogin/php-saml/"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"robrichards/xmlseclibs": ">=3.0.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^1.0.2 || ^2.0",
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1",
|
||||
"sebastian/phpcpd": "^2.0 || ^3.0 || ^4.0",
|
||||
"phploc/phploc": "^2.1 || ^3.0 || ^4.0",
|
||||
"pdepend/pdepend": "^2.5.0",
|
||||
"squizlabs/php_codesniffer": "^3.1.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)",
|
||||
"ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs",
|
||||
"ext-gettext": "Install gettext and php5-gettext libs to handle translations"
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="OneLogin PHP-SAML Test Suite">
|
||||
<directory>./tests/src</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory>./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<log type="coverage-html" target="./tests/build/coverage" lowUpperBound="35" highLowerBound="70"/>
|
||||
<log type="coverage-xml" target="./tests/build/logfile.xml"/>
|
||||
<log type="coverage-clover" target="./tests/build/logs/clover.xml"/>
|
||||
<log type="coverage-php" target="./tests/build/logs/coverage.cov"/>
|
||||
</logging>
|
||||
</phpunit>
|
|
@ -1,137 +0,0 @@
|
|||
<?php
|
||||
|
||||
$settings = array(
|
||||
// If 'strict' is True, then the PHP Toolkit will reject unsigned
|
||||
// or unencrypted messages if it expects them signed or encrypted
|
||||
// Also will reject the messages if not strictly follow the SAML
|
||||
// standard: Destination, NameId, Conditions ... are validated too.
|
||||
'strict' => true,
|
||||
|
||||
// Enable debug mode (to print errors)
|
||||
'debug' => false,
|
||||
|
||||
// Set a BaseURL to be used instead of try to guess
|
||||
// the BaseURL of the view that process the SAML Message.
|
||||
// Ex. http://sp.example.com/
|
||||
// http://example.com/sp/
|
||||
'baseurl' => null,
|
||||
|
||||
// Service Provider Data that we are deploying
|
||||
'sp' => array(
|
||||
// Identifier of the SP entity (must be a URI)
|
||||
'entityId' => '',
|
||||
// Specifies info about where and how the <AuthnResponse> message MUST be
|
||||
// returned to the requester, in this case our SP.
|
||||
'assertionConsumerService' => array(
|
||||
// URL Location where the <Response> from the IdP will be returned
|
||||
'url' => '',
|
||||
// SAML protocol binding to be used when returning the <Response>
|
||||
// message. Onelogin Toolkit supports for this endpoint the
|
||||
// HTTP-POST binding only
|
||||
'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
|
||||
),
|
||||
// If you need to specify requested attributes, set a
|
||||
// attributeConsumingService. nameFormat, attributeValue and
|
||||
// friendlyName can be omitted. Otherwise remove this section.
|
||||
"attributeConsumingService"=> array(
|
||||
"serviceName" => "SP test",
|
||||
"serviceDescription" => "Test Service",
|
||||
"requestedAttributes" => array(
|
||||
array(
|
||||
"name" => "",
|
||||
"isRequired" => false,
|
||||
"nameFormat" => "",
|
||||
"friendlyName" => "",
|
||||
"attributeValue" => ""
|
||||
)
|
||||
)
|
||||
),
|
||||
// Specifies info about where and how the <Logout Response> message MUST be
|
||||
// returned to the requester, in this case our SP.
|
||||
'singleLogoutService' => array(
|
||||
// URL Location where the <Response> from the IdP will be returned
|
||||
'url' => '',
|
||||
// SAML protocol binding to be used when returning the <Response>
|
||||
// message. Onelogin Toolkit supports for this endpoint the
|
||||
// HTTP-Redirect binding only
|
||||
'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||
),
|
||||
// Specifies constraints on the name identifier to be used to
|
||||
// represent the requested subject.
|
||||
// Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
|
||||
'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified',
|
||||
|
||||
// Usually x509cert and privateKey of the SP are provided by files placed at
|
||||
// the certs folder. But we can also provide them with the following parameters
|
||||
'x509cert' => '',
|
||||
'privateKey' => '',
|
||||
|
||||
/*
|
||||
* Key rollover
|
||||
* If you plan to update the SP x509cert and privateKey
|
||||
* you can define here the new x509cert and it will be
|
||||
* published on the SP metadata so Identity Providers can
|
||||
* read them and get ready for rollover.
|
||||
*/
|
||||
// 'x509certNew' => '',
|
||||
),
|
||||
|
||||
// Identity Provider Data that we want connect with our SP
|
||||
'idp' => array(
|
||||
// Identifier of the IdP entity (must be a URI)
|
||||
'entityId' => '',
|
||||
// SSO endpoint info of the IdP. (Authentication Request protocol)
|
||||
'singleSignOnService' => array(
|
||||
// URL Target of the IdP where the SP will send the Authentication Request Message
|
||||
'url' => '',
|
||||
// SAML protocol binding to be used when returning the <Response>
|
||||
// message. Onelogin Toolkit supports for this endpoint the
|
||||
// HTTP-Redirect binding only
|
||||
'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||
),
|
||||
// SLO endpoint info of the IdP.
|
||||
'singleLogoutService' => array(
|
||||
// URL Location of the IdP where the SP will send the SLO Request
|
||||
'url' => '',
|
||||
// URL location of the IdP where the SP SLO Response will be sent (ResponseLocation)
|
||||
// if not set, url for the SLO Request will be used
|
||||
'responseUrl' => '',
|
||||
// SAML protocol binding to be used when returning the <Response>
|
||||
// message. Onelogin Toolkit supports for this endpoint the
|
||||
// HTTP-Redirect binding only
|
||||
'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||
),
|
||||
// Public x509 certificate of the IdP
|
||||
'x509cert' => '',
|
||||
/*
|
||||
* Instead of use the whole x509cert you can use a fingerprint in
|
||||
* order to validate the SAMLResponse, but we don't recommend to use
|
||||
* that method on production since is exploitable by a collision
|
||||
* attack.
|
||||
* (openssl x509 -noout -fingerprint -in "idp.crt" to generate it,
|
||||
* or add for example the -sha256 , -sha384 or -sha512 parameter)
|
||||
*
|
||||
* If a fingerprint is provided, then the certFingerprintAlgorithm is required in order to
|
||||
* let the toolkit know which Algorithm was used. Possible values: sha1, sha256, sha384 or sha512
|
||||
* 'sha1' is the default value.
|
||||
*/
|
||||
// 'certFingerprint' => '',
|
||||
// 'certFingerprintAlgorithm' => 'sha1',
|
||||
|
||||
/* In some scenarios the IdP uses different certificates for
|
||||
* signing/encryption, or is under key rollover phase and more
|
||||
* than one certificate is published on IdP metadata.
|
||||
* In order to handle that the toolkit offers that parameter.
|
||||
* (when used, 'x509cert' and 'certFingerprint' values are
|
||||
* ignored).
|
||||
*/
|
||||
// 'x509certMulti' => array(
|
||||
// 'signing' => array(
|
||||
// 0 => '<cert1-string>',
|
||||
// ),
|
||||
// 'encryption' => array(
|
||||
// 0 => '<cert2-string>',
|
||||
// )
|
||||
// ),
|
||||
),
|
||||
);
|
|
@ -1,826 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of php-saml.
|
||||
*
|
||||
* (c) OneLogin Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @package OneLogin
|
||||
* @author OneLogin Inc <saml-info@onelogin.com>
|
||||
* @license MIT https://github.com/onelogin/php-saml/blob/master/LICENSE
|
||||
* @link https://github.com/onelogin/php-saml
|
||||
*/
|
||||
|
||||
namespace OneLogin\Saml2;
|
||||
|
||||
use RobRichards\XMLSecLibs\XMLSecurityKey;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Main class of OneLogin's PHP Toolkit
|
||||
*/
|
||||
class Auth
|
||||
{
|
||||
/**
|
||||
* Settings data.
|
||||
*
|
||||
* @var Settings
|
||||
*/
|
||||
private $_settings;
|
||||
|
||||
/**
|
||||
* User attributes data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_attributes = array();
|
||||
|
||||
/**
|
||||
* User attributes data with FriendlyName index.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_attributesWithFriendlyName = array();
|
||||
|
||||
/**
|
||||
* NameID
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_nameid;
|
||||
|
||||
/**
|
||||
* NameID Format
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_nameidFormat;
|
||||
|
||||
/**
|
||||
* NameID NameQualifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_nameidNameQualifier;
|
||||
|
||||
/**
|
||||
* NameID SP NameQualifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_nameidSPNameQualifier;
|
||||
|
||||
/**
|
||||
* If user is authenticated.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_authenticated = false;
|
||||
|
||||
|
||||
/**
|
||||
* SessionIndex. When the user is logged, this stored it
|
||||
* from the AuthnStatement of the SAML Response
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_sessionIndex;
|
||||
|
||||
/**
|
||||
* SessionNotOnOrAfter. When the user is logged, this stored it
|
||||
* from the AuthnStatement of the SAML Response
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
private $_sessionExpiration;
|
||||
|
||||
/**
|
||||
* The ID of the last message processed
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_lastMessageId;
|
||||
|
||||
/**
|
||||
* The ID of the last assertion processed
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_lastAssertionId;
|
||||
|
||||
/**
|
||||
* The NotOnOrAfter value of the valid SubjectConfirmationData
|
||||
* node (if any) of the last assertion processed
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_lastAssertionNotOnOrAfter;
|
||||
|
||||
/**
|
||||
* If any error.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_errors = array();
|
||||
|
||||
/**
|
||||
* Last error object.
|
||||
*
|
||||
* @var Error|null
|
||||
*/
|
||||
private $_lastErrorException;
|
||||
|
||||
/**
|
||||
* Last error.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $_lastError;
|
||||
|
||||
/**
|
||||
* Last AuthNRequest ID or LogoutRequest ID generated by this Service Provider
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_lastRequestID;
|
||||
|
||||
/**
|
||||
* The most recently-constructed/processed XML SAML request
|
||||
* (AuthNRequest, LogoutRequest)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_lastRequest;
|
||||
|
||||
/**
|
||||
* The most recently-constructed/processed XML SAML response
|
||||
* (SAMLResponse, LogoutResponse). If the SAMLResponse was
|
||||
* encrypted, by default tries to return the decrypted XML
|
||||
*
|
||||
* @var string|\DomDocument|null
|
||||
*/
|
||||
private $_lastResponse;
|
||||
|
||||
/**
|
||||
* Initializes the SP SAML instance.
|
||||
*
|
||||
* @param array|null $settings Setting data
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Error
|
||||
*/
|
||||
public function __construct(array $settings = null)
|
||||
{
|
||||
$this->_settings = new Settings($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the settings info
|
||||
*
|
||||
* @return Settings The settings data.
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
return $this->_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the strict mode active/disable
|
||||
*
|
||||
* @param bool $value Strict parameter
|
||||
*
|
||||
* @throws Error
|
||||
*/
|
||||
public function setStrict($value)
|
||||
{
|
||||
if (!is_bool($value)) {
|
||||
throw new Error(
|
||||
'Invalid value passed to setStrict()',
|
||||
Error::SETTINGS_INVALID_SYNTAX
|
||||
);
|
||||
}
|
||||
|
||||
$this->_settings->setStrict($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set schemas path
|
||||
*
|
||||
* @param string $path
|
||||
* @return $this
|
||||
*/
|
||||
public function setSchemasPath($path)
|
||||
{
|
||||
$this->_paths['schemas'] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the SAML Response sent by the IdP.
|
||||
*
|
||||
* @param string|null $requestId The ID of the AuthNRequest sent by this SP to the IdP
|
||||
*
|
||||
* @throws Error
|
||||
* @throws ValidationError
|
||||
*/
|
||||
public function processResponse($requestId = null)
|
||||
{
|
||||
$this->_errors = array();
|
||||
$this->_lastError = $this->_lastErrorException = null;
|
||||
if (isset($_POST['SAMLResponse'])) {
|
||||
// AuthnResponse -- HTTP_POST Binding
|
||||
$response = new Response($this->_settings, $_POST['SAMLResponse']);
|
||||
$this->_lastResponse = $response->getXMLDocument();
|
||||
|
||||
if ($response->isValid($requestId)) {
|
||||
$this->_attributes = $response->getAttributes();
|
||||
$this->_attributesWithFriendlyName = $response->getAttributesWithFriendlyName();
|
||||
$this->_nameid = $response->getNameId();
|
||||
$this->_nameidFormat = $response->getNameIdFormat();
|
||||
$this->_nameidNameQualifier = $response->getNameIdNameQualifier();
|
||||
$this->_nameidSPNameQualifier = $response->getNameIdSPNameQualifier();
|
||||
$this->_authenticated = true;
|
||||
$this->_sessionIndex = $response->getSessionIndex();
|
||||
$this->_sessionExpiration = $response->getSessionNotOnOrAfter();
|
||||
$this->_lastMessageId = $response->getId();
|
||||
$this->_lastAssertionId = $response->getAssertionId();
|
||||
$this->_lastAssertionNotOnOrAfter = $response->getAssertionNotOnOrAfter();
|
||||
} else {
|
||||
$this->_errors[] = 'invalid_response';
|
||||
$this->_lastErrorException = $response->getErrorException();
|
||||
$this->_lastError = $response->getError();
|
||||
}
|
||||
} else {
|
||||
$this->_errors[] = 'invalid_binding';
|
||||
throw new Error(
|
||||
'SAML Response not found, Only supported HTTP_POST Binding',
|
||||
Error::SAML_RESPONSE_NOT_FOUND
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the SAML Logout Response / Logout Request sent by the IdP.
|
||||
*
|
||||
* @param bool $keepLocalSession When false will destroy the local session, otherwise will keep it
|
||||
* @param string|null $requestId The ID of the LogoutRequest sent by this SP to the IdP
|
||||
* @param bool $retrieveParametersFromServer True if we want to use parameters from $_SERVER to validate the signature
|
||||
* @param callable $cbDeleteSession Callback to be executed to delete session
|
||||
* @param bool $stay True if we want to stay (returns the url string) False to redirect
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @throws Error
|
||||
*/
|
||||
public function processSLO($keepLocalSession = false, $requestId = null, $retrieveParametersFromServer = false, $cbDeleteSession = null, $stay = false)
|
||||
{
|
||||
$this->_errors = array();
|
||||
$this->_lastError = $this->_lastErrorException = null;
|
||||
if (isset($_GET['SAMLResponse'])) {
|
||||
$logoutResponse = new LogoutResponse($this->_settings, $_GET['SAMLResponse']);
|
||||
$this->_lastResponse = $logoutResponse->getXML();
|
||||
if (!$logoutResponse->isValid($requestId, $retrieveParametersFromServer)) {
|
||||
$this->_errors[] = 'invalid_logout_response';
|
||||
$this->_lastErrorException = $logoutResponse->getErrorException();
|
||||
$this->_lastError = $logoutResponse->getError();
|
||||
|
||||
} else if ($logoutResponse->getStatus() !== Constants::STATUS_SUCCESS) {
|
||||
$this->_errors[] = 'logout_not_success';
|
||||
} else {
|
||||
$this->_lastMessageId = $logoutResponse->id;
|
||||
if (!$keepLocalSession) {
|
||||
if ($cbDeleteSession === null) {
|
||||
Utils::deleteLocalSession();
|
||||
} else {
|
||||
call_user_func($cbDeleteSession);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (isset($_GET['SAMLRequest'])) {
|
||||
$logoutRequest = new LogoutRequest($this->_settings, $_GET['SAMLRequest']);
|
||||
$this->_lastRequest = $logoutRequest->getXML();
|
||||
if (!$logoutRequest->isValid($retrieveParametersFromServer)) {
|
||||
$this->_errors[] = 'invalid_logout_request';
|
||||
$this->_lastErrorException = $logoutRequest->getErrorException();
|
||||
$this->_lastError = $logoutRequest->getError();
|
||||
} else {
|
||||
if (!$keepLocalSession) {
|
||||
if ($cbDeleteSession === null) {
|
||||
Utils::deleteLocalSession();
|
||||
} else {
|
||||
call_user_func($cbDeleteSession);
|
||||
}
|
||||
}
|
||||
$inResponseTo = $logoutRequest->id;
|
||||
$this->_lastMessageId = $logoutRequest->id;
|
||||
$responseBuilder = new LogoutResponse($this->_settings);
|
||||
$responseBuilder->build($inResponseTo);
|
||||
$this->_lastResponse = $responseBuilder->getXML();
|
||||
|
||||
$logoutResponse = $responseBuilder->getResponse();
|
||||
|
||||
$parameters = array('SAMLResponse' => $logoutResponse);
|
||||
if (isset($_GET['RelayState'])) {
|
||||
$parameters['RelayState'] = $_GET['RelayState'];
|
||||
}
|
||||
|
||||
$security = $this->_settings->getSecurityData();
|
||||
if (isset($security['logoutResponseSigned']) && $security['logoutResponseSigned']) {
|
||||
$signature = $this->buildResponseSignature($logoutResponse, isset($parameters['RelayState'])? $parameters['RelayState']: null, $security['signatureAlgorithm']);
|
||||
$parameters['SigAlg'] = $security['signatureAlgorithm'];
|
||||
$parameters['Signature'] = $signature;
|
||||
}
|
||||
|
||||
return $this->redirectTo($this->getSLOResponseUrl(), $parameters, $stay);
|
||||
}
|
||||
} else {
|
||||
$this->_errors[] = 'invalid_binding';
|
||||
throw new Error(
|
||||
'SAML LogoutRequest/LogoutResponse not found. Only supported HTTP_REDIRECT Binding',
|
||||
Error::SAML_LOGOUTMESSAGE_NOT_FOUND
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects the user to the url past by parameter
|
||||
* or to the url that we defined in our SSO Request.
|
||||
*
|
||||
* @param string $url The target URL to redirect the user.
|
||||
* @param array $parameters Extra parameters to be passed as part of the url
|
||||
* @param bool $stay True if we want to stay (returns the url string) False to redirect
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function redirectTo($url = '', array $parameters = array(), $stay = false)
|
||||
{
|
||||
assert(is_string($url));
|
||||
|
||||
if (empty($url) && isset($_REQUEST['RelayState'])) {
|
||||
$url = $_REQUEST['RelayState'];
|
||||
}
|
||||
|
||||
return Utils::redirect($url, $parameters, $stay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is authenticated or not.
|
||||
*
|
||||
* @return bool True if the user is authenticated
|
||||
*/
|
||||
public function isAuthenticated()
|
||||
{
|
||||
return $this->_authenticated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of SAML attributes.
|
||||
*
|
||||
* @return array Attributes of the user.
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
return $this->_attributes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the set of SAML attributes indexed by FriendlyName
|
||||
*
|
||||
* @return array Attributes of the user.
|
||||
*/
|
||||
public function getAttributesWithFriendlyName()
|
||||
{
|
||||
return $this->_attributesWithFriendlyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nameID
|
||||
*
|
||||
* @return string The nameID of the assertion
|
||||
*/
|
||||
public function getNameId()
|
||||
{
|
||||
return $this->_nameid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nameID Format
|
||||
*
|
||||
* @return string The nameID Format of the assertion
|
||||
*/
|
||||
public function getNameIdFormat()
|
||||
{
|
||||
return $this->_nameidFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nameID NameQualifier
|
||||
*
|
||||
* @return string The nameID NameQualifier of the assertion
|
||||
*/
|
||||
public function getNameIdNameQualifier()
|
||||
{
|
||||
return $this->_nameidNameQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nameID SP NameQualifier
|
||||
*
|
||||
* @return string The nameID SP NameQualifier of the assertion
|
||||
*/
|
||||
public function getNameIdSPNameQualifier()
|
||||
{
|
||||
return $this->_nameidSPNameQualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SessionIndex
|
||||
*
|
||||
* @return string|null The SessionIndex of the assertion
|
||||
*/
|
||||
public function getSessionIndex()
|
||||
{
|
||||
return $this->_sessionIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SessionNotOnOrAfter
|
||||
*
|
||||
* @return int|null The SessionNotOnOrAfter of the assertion
|
||||
*/
|
||||
public function getSessionExpiration()
|
||||
{
|
||||
return $this->_sessionExpiration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if there were any error
|
||||
*
|
||||
* @return array Errors
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->_errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reason for the last error
|
||||
*
|
||||
* @return string|null Error reason
|
||||
*/
|
||||
public function getLastErrorReason()
|
||||
{
|
||||
return $this->_lastError;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the last error
|
||||
*
|
||||
* @return Exception|null Error
|
||||
*/
|
||||
public function getLastErrorException()
|
||||
{
|
||||
return $this->_lastErrorException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requested SAML attribute
|
||||
*
|
||||
* @param string $name The requested attribute of the user.
|
||||
*
|
||||
* @return array|null Requested SAML attribute ($name).
|
||||
*/
|
||||
public function getAttribute($name)
|
||||
{
|
||||
assert(is_string($name));
|
||||
|
||||
$value = null;
|
||||
if (isset($this->_attributes[$name])) {
|
||||
return $this->_attributes[$name];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requested SAML attribute indexed by FriendlyName
|
||||
*
|
||||
* @param string $friendlyName The requested attribute of the user.
|
||||
*
|
||||
* @return array|null Requested SAML attribute ($friendlyName).
|
||||
*/
|
||||
public function getAttributeWithFriendlyName($friendlyName)
|
||||
{
|
||||
assert(is_string($friendlyName));
|
||||
$value = null;
|
||||
if (isset($this->_attributesWithFriendlyName[$friendlyName])) {
|
||||
return $this->_attributesWithFriendlyName[$friendlyName];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the SSO process.
|
||||
*
|
||||
* @param string|null $returnTo The target URL the user should be returned to after login.
|
||||
* @param array $parameters Extra parameters to be added to the GET
|
||||
* @param bool $forceAuthn When true the AuthNRequest will set the ForceAuthn='true'
|
||||
* @param bool $isPassive When true the AuthNRequest will set the Ispassive='true'
|
||||
* @param bool $stay True if we want to stay (returns the url string) False to redirect
|
||||
* @param bool $setNameIdPolicy When true the AuthNRequest will set a nameIdPolicy element
|
||||
* @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated
|
||||
*
|
||||
* @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
|
||||
*
|
||||
* @throws Error
|
||||
*/
|
||||
public function login($returnTo = null, array $parameters = array(), $forceAuthn = false, $isPassive = false, $stay = false, $setNameIdPolicy = true, $nameIdValueReq = null)
|
||||
{
|
||||
$authnRequest = $this->buildAuthnRequest($this->_settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq);
|
||||
|
||||
$this->_lastRequest = $authnRequest->getXML();
|
||||
$this->_lastRequestID = $authnRequest->getId();
|
||||
|
||||
$samlRequest = $authnRequest->getRequest();
|
||||
$parameters['SAMLRequest'] = $samlRequest;
|
||||
|
||||
if (!empty($returnTo)) {
|
||||
$parameters['RelayState'] = $returnTo;
|
||||
} else {
|
||||
$parameters['RelayState'] = Utils::getSelfRoutedURLNoQuery();
|
||||
}
|
||||
|
||||
$security = $this->_settings->getSecurityData();
|
||||
if (isset($security['authnRequestsSigned']) && $security['authnRequestsSigned']) {
|
||||
$signature = $this->buildRequestSignature($samlRequest, $parameters['RelayState'], $security['signatureAlgorithm']);
|
||||
$parameters['SigAlg'] = $security['signatureAlgorithm'];
|
||||
$parameters['Signature'] = $signature;
|
||||
}
|
||||
return $this->redirectTo($this->getSSOurl(), $parameters, $stay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the SLO process.
|
||||
*
|
||||
* @param string|null $returnTo The target URL the user should be returned to after logout.
|
||||
* @param array $parameters Extra parameters to be added to the GET
|
||||
* @param string|null $nameId The NameID that will be set in the LogoutRequest.
|
||||
* @param string|null $sessionIndex The SessionIndex (taken from the SAML Response in the SSO process).
|
||||
* @param bool $stay True if we want to stay (returns the url string) False to redirect
|
||||
* @param string|null $nameIdFormat The NameID Format will be set in the LogoutRequest.
|
||||
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
|
||||
*
|
||||
* @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
|
||||
*
|
||||
* @throws Error
|
||||
*/
|
||||
public function logout($returnTo = null, array $parameters = array(), $nameId = null, $sessionIndex = null, $stay = false, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
|
||||
{
|
||||
$sloUrl = $this->getSLOurl();
|
||||
if (empty($sloUrl)) {
|
||||
throw new Error(
|
||||
'The IdP does not support Single Log Out',
|
||||
Error::SAML_SINGLE_LOGOUT_NOT_SUPPORTED
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($nameId) && !empty($this->_nameid)) {
|
||||
$nameId = $this->_nameid;
|
||||
}
|
||||
if (empty($nameIdFormat) && !empty($this->_nameidFormat)) {
|
||||
$nameIdFormat = $this->_nameidFormat;
|
||||
}
|
||||
|
||||
$logoutRequest = new LogoutRequest($this->_settings, null, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
|
||||
|
||||
$this->_lastRequest = $logoutRequest->getXML();
|
||||
$this->_lastRequestID = $logoutRequest->id;
|
||||
|
||||
$samlRequest = $logoutRequest->getRequest();
|
||||
|
||||
$parameters['SAMLRequest'] = $samlRequest;
|
||||
if (!empty($returnTo)) {
|
||||
$parameters['RelayState'] = $returnTo;
|
||||
} else {
|
||||
$parameters['RelayState'] = Utils::getSelfRoutedURLNoQuery();
|
||||
}
|
||||
|
||||
$security = $this->_settings->getSecurityData();
|
||||
if (isset($security['logoutRequestSigned']) && $security['logoutRequestSigned']) {
|
||||
$signature = $this->buildRequestSignature($samlRequest, $parameters['RelayState'], $security['signatureAlgorithm']);
|
||||
$parameters['SigAlg'] = $security['signatureAlgorithm'];
|
||||
$parameters['Signature'] = $signature;
|
||||
}
|
||||
|
||||
return $this->redirectTo($sloUrl, $parameters, $stay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SSO url.
|
||||
*
|
||||
* @return string The url of the Single Sign On Service
|
||||
*/
|
||||
public function getSSOurl()
|
||||
{
|
||||
$idpData = $this->_settings->getIdPData();
|
||||
return $idpData['singleSignOnService']['url'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SLO url.
|
||||
*
|
||||
* @return string|null The url of the Single Logout Service
|
||||
*/
|
||||
public function getSLOurl()
|
||||
{
|
||||
$url = null;
|
||||
$idpData = $this->_settings->getIdPData();
|
||||
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['url'])) {
|
||||
$url = $idpData['singleLogoutService']['url'];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SLO response url.
|
||||
*
|
||||
* @return string|null The response url of the Single Logout Service
|
||||
*/
|
||||
public function getSLOResponseUrl()
|
||||
{
|
||||
$idpData = $this->_settings->getIdPData();
|
||||
if (isset($idpData['singleLogoutService']) && isset($idpData['singleLogoutService']['responseUrl'])) {
|
||||
return $idpData['singleLogoutService']['responseUrl'];
|
||||
}
|
||||
return $this->getSLOurl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID of the last AuthNRequest or LogoutRequest generated by the Service Provider.
|
||||
*
|
||||
* @return string The ID of the Request SAML message.
|
||||
*/
|
||||
public function getLastRequestID()
|
||||
{
|
||||
return $this->_lastRequestID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AuthnRequest
|
||||
*
|
||||
* @param Settings $settings Setting data
|
||||
* @param bool $forceAuthn When true the AuthNRequest will set the ForceAuthn='true'
|
||||
* @param bool $isPassive When true the AuthNRequest will set the Ispassive='true'
|
||||
* @param bool $setNameIdPolicy When true the AuthNRequest will set a nameIdPolicy element
|
||||
* @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated
|
||||
*
|
||||
* @return AuthnRequest The AuthnRequest object
|
||||
*/
|
||||
public function buildAuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq = null)
|
||||
{
|
||||
return new AuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the Signature for a SAML Request
|
||||
*
|
||||
* @param string $samlRequest The SAML Request
|
||||
* @param string $relayState The RelayState
|
||||
* @param string $signAlgorithm Signature algorithm method
|
||||
*
|
||||
* @return string A base64 encoded signature
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Error
|
||||
*/
|
||||
public function buildRequestSignature($samlRequest, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256)
|
||||
{
|
||||
return $this->buildMessageSignature($samlRequest, $relayState, $signAlgorithm, "SAMLRequest");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the Signature for a SAML Response
|
||||
*
|
||||
* @param string $samlResponse The SAML Response
|
||||
* @param string $relayState The RelayState
|
||||
* @param string $signAlgorithm Signature algorithm method
|
||||
*
|
||||
* @return string A base64 encoded signature
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Error
|
||||
*/
|
||||
public function buildResponseSignature($samlResponse, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256)
|
||||
{
|
||||
return $this->buildMessageSignature($samlResponse, $relayState, $signAlgorithm, "SAMLResponse");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the Signature for a SAML Message
|
||||
*
|
||||
* @param string $samlMessage The SAML Message
|
||||
* @param string $relayState The RelayState
|
||||
* @param string $signAlgorithm Signature algorithm method
|
||||
* @param string $type "SAMLRequest" or "SAMLResponse"
|
||||
*
|
||||
* @return string A base64 encoded signature
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Error
|
||||
*/
|
||||
private function buildMessageSignature($samlMessage, $relayState, $signAlgorithm = XMLSecurityKey::RSA_SHA256, $type = "SAMLRequest")
|
||||
{
|
||||
$key = $this->_settings->getSPkey();
|
||||
if (empty($key)) {
|
||||
if ($type == "SAMLRequest") {
|
||||
$errorMsg = "Trying to sign the SAML Request but can't load the SP private key";
|
||||
} else {
|
||||
$errorMsg = "Trying to sign the SAML Response but can't load the SP private key";
|
||||
}
|
||||
|
||||
throw new Error($errorMsg, Error::PRIVATE_KEY_NOT_FOUND);
|
||||
}
|
||||
|
||||
$objKey = new XMLSecurityKey($signAlgorithm, array('type' => 'private'));
|
||||
$objKey->loadKey($key, false);
|
||||
|
||||
$security = $this->_settings->getSecurityData();
|
||||
if ($security['lowercaseUrlencoding']) {
|
||||
$msg = $type.'='.rawurlencode($samlMessage);
|
||||
if (isset($relayState)) {
|
||||
$msg .= '&RelayState='.rawurlencode($relayState);
|
||||
}
|
||||
$msg .= '&SigAlg=' . rawurlencode($signAlgorithm);
|
||||
} else {
|
||||
$msg = $type.'='.urlencode($samlMessage);
|
||||
if (isset($relayState)) {
|
||||
$msg .= '&RelayState='.urlencode($relayState);
|
||||
}
|
||||
$msg .= '&SigAlg=' . urlencode($signAlgorithm);
|
||||
}
|
||||
$signature = $objKey->signData($msg);
|
||||
return base64_encode($signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The ID of the last message processed
|
||||
*/
|
||||
public function getLastMessageId()
|
||||
{
|
||||
return $this->_lastMessageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The ID of the last assertion processed
|
||||
*/
|
||||
public function getLastAssertionId()
|
||||
{
|
||||
return $this->_lastAssertionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int The NotOnOrAfter value of the valid
|
||||
* SubjectConfirmationData node (if any)
|
||||
* of the last assertion processed
|
||||
*/
|
||||
public function getLastAssertionNotOnOrAfter()
|
||||
{
|
||||
return $this->_lastAssertionNotOnOrAfter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most recently-constructed/processed
|
||||
* XML SAML request (AuthNRequest, LogoutRequest)
|
||||
*
|
||||
* @return string|null The Request XML
|
||||
*/
|
||||
public function getLastRequestXML()
|
||||
{
|
||||
return $this->_lastRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most recently-constructed/processed
|
||||
* XML SAML response (SAMLResponse, LogoutResponse).
|
||||
* If the SAMLResponse was encrypted, by default tries
|
||||
* to return the decrypted XML.
|
||||
*
|
||||
* @return string|null The Response XML
|
||||
*/
|
||||
public function getLastResponseXML()
|
||||
{
|
||||
$response = null;
|
||||
if (isset($this->_lastResponse)) {
|
||||
if (is_string($this->_lastResponse)) {
|
||||
$response = $this->_lastResponse;
|
||||
} else {
|
||||
$response = $this->_lastResponse->saveXML();
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
|
@ -1,214 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of php-saml.
|
||||
*
|
||||
* (c) OneLogin Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @package OneLogin
|
||||
* @author OneLogin Inc <saml-info@onelogin.com>
|
||||
* @license MIT https://github.com/onelogin/php-saml/blob/master/LICENSE
|
||||
* @link https://github.com/onelogin/php-saml
|
||||
*/
|
||||
|
||||
namespace OneLogin\Saml2;
|
||||
|
||||
/**
|
||||
* SAML 2 Authentication Request
|
||||
*/
|
||||
class AuthnRequest
|
||||
{
|
||||
/**
|
||||
* Object that represents the setting info
|
||||
*
|
||||
* @var Settings
|
||||
*/
|
||||
protected $_settings;
|
||||
|
||||
/**
|
||||
* SAML AuthNRequest string
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_authnRequest;
|
||||
|
||||
/**
|
||||
* SAML AuthNRequest ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_id;
|
||||
|
||||
/**
|
||||
* Constructs the AuthnRequest object.
|
||||
*
|
||||
* @param Settings $settings SAML Toolkit Settings
|
||||
* @param bool $forceAuthn When true the AuthNReuqest will set the ForceAuthn='true'
|
||||
* @param bool $isPassive When true the AuthNReuqest will set the Ispassive='true'
|
||||
* @param bool $setNameIdPolicy When true the AuthNReuqest will set a nameIdPolicy
|
||||
* @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated
|
||||
*/
|
||||
public function __construct(\OneLogin\Saml2\Settings $settings, $forceAuthn = false, $isPassive = false, $setNameIdPolicy = true, $nameIdValueReq = null)
|
||||
{
|
||||
$this->_settings = $settings;
|
||||
|
||||
$spData = $this->_settings->getSPData();
|
||||
$idpData = $this->_settings->getIdPData();
|
||||
$security = $this->_settings->getSecurityData();
|
||||
|
||||
$id = Utils::generateUniqueID();
|
||||
$issueInstant = Utils::parseTime2SAML(time());
|
||||
|
||||
$subjectStr = "";
|
||||
if (isset($nameIdValueReq)) {
|
||||
$subjectStr = <<<SUBJECT
|
||||
|
||||
<saml:Subject>
|
||||
<saml:NameID Format="{$spData['NameIDFormat']}">{$nameIdValueReq}</saml:NameID>
|
||||
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"></saml:SubjectConfirmation>
|
||||
</saml:Subject>
|
||||
SUBJECT;
|
||||
}
|
||||
|
||||
$nameIdPolicyStr = '';
|
||||
if ($setNameIdPolicy) {
|
||||
$nameIDPolicyFormat = $spData['NameIDFormat'];
|
||||
if (isset($security['wantNameIdEncrypted']) && $security['wantNameIdEncrypted']) {
|
||||
$nameIDPolicyFormat = Constants::NAMEID_ENCRYPTED;
|
||||
}
|
||||
|
||||
$nameIdPolicyStr = <<<NAMEIDPOLICY
|
||||
|
||||
<samlp:NameIDPolicy
|
||||
Format="{$nameIDPolicyFormat}"
|
||||
AllowCreate="true" />
|
||||
NAMEIDPOLICY;
|
||||
}
|
||||
|
||||
|
||||
$providerNameStr = '';
|
||||
$organizationData = $settings->getOrganization();
|
||||
if (!empty($organizationData)) {
|
||||
$langs = array_keys($organizationData);
|
||||
if (in_array('en-US', $langs)) {
|
||||
$lang = 'en-US';
|
||||
} else {
|
||||
$lang = $langs[0];
|
||||
}
|
||||
if (isset($organizationData[$lang]['displayname']) && !empty($organizationData[$lang]['displayname'])) {
|
||||
$providerNameStr = <<<PROVIDERNAME
|
||||
ProviderName="{$organizationData[$lang]['displayname']}"
|
||||
PROVIDERNAME;
|
||||
}
|
||||
}
|
||||
|
||||
$forceAuthnStr = '';
|
||||
if ($forceAuthn) {
|
||||
$forceAuthnStr = <<<FORCEAUTHN
|
||||
|
||||
ForceAuthn="true"
|
||||
FORCEAUTHN;
|
||||
}
|
||||
|
||||
$isPassiveStr = '';
|
||||
if ($isPassive) {
|
||||
$isPassiveStr = <<<ISPASSIVE
|
||||
|
||||
IsPassive="true"
|
||||
ISPASSIVE;
|
||||
}
|
||||
|
||||
$requestedAuthnStr = '';
|
||||
if (isset($security['requestedAuthnContext']) && $security['requestedAuthnContext'] !== false) {
|
||||
$authnComparison = 'exact';
|
||||
if (isset($security['requestedAuthnContextComparison'])) {
|
||||
$authnComparison = $security['requestedAuthnContextComparison'];
|
||||
}
|
||||
|
||||
$authnComparisonAttr = '';
|
||||
if (!empty($authnComparison)) {
|
||||
$authnComparisonAttr = sprintf('Comparison="%s"', $authnComparison);
|
||||
}
|
||||
|
||||
if ($security['requestedAuthnContext'] === true) {
|
||||
$requestedAuthnStr = <<<REQUESTEDAUTHN
|
||||
|
||||
<samlp:RequestedAuthnContext $authnComparisonAttr>
|
||||
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
|
||||
</samlp:RequestedAuthnContext>
|
||||
REQUESTEDAUTHN;
|
||||
} else {
|
||||
$requestedAuthnStr .= " <samlp:RequestedAuthnContext $authnComparisonAttr>\n";
|
||||
foreach ($security['requestedAuthnContext'] as $contextValue) {
|
||||
$requestedAuthnStr .= " <saml:AuthnContextClassRef>".$contextValue."</saml:AuthnContextClassRef>\n";
|
||||
}
|
||||
$requestedAuthnStr .= ' </samlp:RequestedAuthnContext>';
|
||||
}
|
||||
}
|
||||
|
||||
$spEntityId = htmlspecialchars($spData['entityId'], ENT_QUOTES);
|
||||
$acsUrl = htmlspecialchars($spData['assertionConsumerService']['url'], ENT_QUOTES);
|
||||
$request = <<<AUTHNREQUEST
|
||||
<samlp:AuthnRequest
|
||||
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
|
||||
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
|
||||
ID="$id"
|
||||
Version="2.0"
|
||||
{$providerNameStr}{$forceAuthnStr}{$isPassiveStr}
|
||||
IssueInstant="$issueInstant"
|
||||
Destination="{$idpData['singleSignOnService']['url']}"
|
||||
ProtocolBinding="{$spData['assertionConsumerService']['binding']}"
|
||||
AssertionConsumerServiceURL="{$acsUrl}">
|
||||
<saml:Issuer>{$spEntityId}</saml:Issuer>{$subjectStr}{$nameIdPolicyStr}{$requestedAuthnStr}
|
||||
</samlp:AuthnRequest>
|
||||
AUTHNREQUEST;
|
||||
|
||||
$this->_id = $id;
|
||||
$this->_authnRequest = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns deflated, base64 encoded, unsigned AuthnRequest.
|
||||
*
|
||||
* @param bool|null $deflate Whether or not we should 'gzdeflate' the request body before we return it.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRequest($deflate = null)
|
||||
{
|
||||
$subject = $this->_authnRequest;
|
||||
|
||||
if (is_null($deflate)) {
|
||||
$deflate = $this->_settings->shouldCompressRequests();
|
||||
}
|
||||
|
||||
if ($deflate) {
|
||||
$subject = gzdeflate($this->_authnRequest);
|
||||
}
|
||||
|
||||
$base64Request = base64_encode($subject);
|
||||
return $base64Request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the AuthNRequest ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the XML that will be sent as part of the request
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getXML()
|
||||
{
|
||||
return $this->_authnRequest;
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of php-saml.
|
||||
*
|
||||
* (c) OneLogin Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @package OneLogin
|
||||
* @author OneLogin Inc <saml-info@onelogin.com>
|
||||
* @license MIT https://github.com/onelogin/php-saml/blob/master/LICENSE
|
||||
* @link https://github.com/onelogin/php-saml
|
||||
*/
|
||||
|
||||
namespace OneLogin\Saml2;
|
||||
|
||||
/**
|
||||
* Constants of OneLogin PHP Toolkit
|
||||
*
|
||||
* Defines all required constants
|
||||
*/
|
||||
class Constants
|
||||
{
|
||||
// Value added to the current time in time condition validations
|
||||
const ALLOWED_CLOCK_DRIFT = 180; // 3 min in seconds
|
||||
|
||||
// NameID Formats
|
||||
const NAMEID_EMAIL_ADDRESS = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress';
|
||||
const NAMEID_X509_SUBJECT_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName';
|
||||
const NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName';
|
||||
const NAMEID_UNSPECIFIED = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified';
|
||||
const NAMEID_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos';
|
||||
const NAMEID_ENTITY = 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity';
|
||||
const NAMEID_TRANSIENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient';
|
||||
const NAMEID_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent';
|
||||
const NAMEID_ENCRYPTED = 'urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted';
|
||||
|
||||
// Attribute Name Formats
|
||||
const ATTRNAME_FORMAT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified';
|
||||
const ATTRNAME_FORMAT_URI = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri';
|
||||
const ATTRNAME_FORMAT_BASIC = 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic';
|
||||
|
||||
// Namespaces
|
||||
const NS_SAML = 'urn:oasis:names:tc:SAML:2.0:assertion';
|
||||
const NS_SAMLP = 'urn:oasis:names:tc:SAML:2.0:protocol';
|
||||
const NS_SOAP = 'http://schemas.xmlsoap.org/soap/envelope/';
|
||||
const NS_MD = 'urn:oasis:names:tc:SAML:2.0:metadata';
|
||||
const NS_XS = 'http://www.w3.org/2001/XMLSchema';
|
||||
const NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance';
|
||||
const NS_XENC = 'http://www.w3.org/2001/04/xmlenc#';
|
||||
const NS_DS = 'http://www.w3.org/2000/09/xmldsig#';
|
||||
|
||||
// Bindings
|
||||
const BINDING_HTTP_POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST';
|
||||
const BINDING_HTTP_REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect';
|
||||
const BINDING_HTTP_ARTIFACT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact';
|
||||
const BINDING_SOAP = 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP';
|
||||
const BINDING_DEFLATE = 'urn:oasis:names:tc:SAML:2.0:bindings:URL-Encoding:DEFLATE';
|
||||
|
||||
// Auth Context Class
|
||||
const AC_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified';
|
||||
const AC_PASSWORD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password';
|
||||
const AC_PASSWORD_PROTECTED = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport';
|
||||
const AC_X509 = 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509';
|
||||
const AC_SMARTCARD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Smartcard';
|
||||
const AC_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos';
|
||||
const AC_WINDOWS = 'urn:federation:authentication:windows';
|
||||
const AC_TLS = 'urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient';
|
||||
|
||||
// Subject Confirmation
|
||||
const CM_BEARER = 'urn:oasis:names:tc:SAML:2.0:cm:bearer';
|
||||
const CM_HOLDER_KEY = 'urn:oasis:names:tc:SAML:2.0:cm:holder-of-key';
|
||||
const CM_SENDER_VOUCHES = 'urn:oasis:names:tc:SAML:2.0:cm:sender-vouches';
|
||||
|
||||
// Status Codes
|
||||
const STATUS_SUCCESS = 'urn:oasis:names:tc:SAML:2.0:status:Success';
|
||||
const STATUS_REQUESTER = 'urn:oasis:names:tc:SAML:2.0:status:Requester';
|
||||
const STATUS_RESPONDER = 'urn:oasis:names:tc:SAML:2.0:status:Responder';
|
||||
const STATUS_VERSION_MISMATCH = 'urn:oasis:names:tc:SAML:2.0:status:VersionMismatch';
|
||||
const STATUS_NO_PASSIVE = 'urn:oasis:names:tc:SAML:2.0:status:NoPassive';
|
||||
const STATUS_PARTIAL_LOGOUT = 'urn:oasis:names:tc:SAML:2.0:status:PartialLogout';
|
||||
const STATUS_PROXY_COUNT_EXCEEDED = 'urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded';
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of php-saml.
|
||||
*
|
||||
* (c) OneLogin Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @package OneLogin
|
||||
* @author OneLogin Inc <saml-info@onelogin.com>
|
||||
* @license MIT https://github.com/onelogin/php-saml/blob/master/LICENSE
|
||||
* @link https://github.com/onelogin/php-saml
|
||||
*/
|
||||
|
||||
namespace OneLogin\Saml2;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Error class of OneLogin PHP Toolkit
|
||||
*
|
||||
* Defines the Error class
|
||||
*/
|
||||
class Error extends Exception
|
||||
{
|
||||
// Errors
|
||||
const SETTINGS_FILE_NOT_FOUND = 0;
|
||||
const SETTINGS_INVALID_SYNTAX = 1;
|
||||
const SETTINGS_INVALID = 2;
|
||||
const METADATA_SP_INVALID = 3;
|
||||
const SP_CERTS_NOT_FOUND = 4;
|
||||
// SP_CERTS_NOT_FOUND is deprecated, use CERT_NOT_FOUND instead
|
||||
const CERT_NOT_FOUND = 4;
|
||||
const REDIRECT_INVALID_URL = 5;
|
||||
const PUBLIC_CERT_FILE_NOT_FOUND = 6;
|
||||
const PRIVATE_KEY_FILE_NOT_FOUND = 7;
|
||||
const SAML_RESPONSE_NOT_FOUND = 8;
|
||||
const SAML_LOGOUTMESSAGE_NOT_FOUND = 9;
|
||||
const SAML_LOGOUTREQUEST_INVALID = 10;
|
||||
const SAML_LOGOUTRESPONSE_INVALID = 11;
|
||||
const SAML_SINGLE_LOGOUT_NOT_SUPPORTED = 12;
|
||||
const PRIVATE_KEY_NOT_FOUND = 13;
|
||||
const UNSUPPORTED_SETTINGS_OBJECT = 14;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $msg Describes the error.
|
||||
* @param int $code The code error (defined in the error class).
|
||||
* @param array|null $args Arguments used in the message that describes the error.
|
||||
*/
|
||||
public function __construct($msg, $code = 0, $args = array())
|
||||
{
|
||||
assert(is_string($msg));
|
||||
assert(is_int($code));
|
||||
|
||||
if (!isset($args)) {
|
||||
$args = array();
|
||||
}
|
||||
$params = array_merge(array($msg), $args);
|
||||
$message = call_user_func_array('sprintf', $params);
|
||||
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
}
|
|
@ -1,243 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of php-saml.
|
||||
*
|
||||
* (c) OneLogin Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @package OneLogin
|
||||
* @author OneLogin Inc <saml-info@onelogin.com>
|
||||
* @license MIT https://github.com/onelogin/php-saml/blob/master/LICENSE
|
||||
* @link https://github.com/onelogin/php-saml
|
||||
*/
|
||||
|
||||
namespace OneLogin\Saml2;
|
||||
|
||||
use DOMDocument;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* IdP Metadata Parser of OneLogin PHP Toolkit
|
||||
*/
|
||||
class IdPMetadataParser
|
||||
{
|
||||
/**
|
||||
* Get IdP Metadata Info from URL
|
||||
*
|
||||
* @param string $url URL where the IdP metadata is published
|
||||
* @param string $entityId Entity Id of the desired IdP, if no
|
||||
* entity Id is provided and the XML
|
||||
* metadata contains more than one
|
||||
* IDPSSODescriptor, the first is returned
|
||||
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
|
||||
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
|
||||
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
|
||||
*
|
||||
* @return array metadata info in php-saml settings format
|
||||
*/
|
||||
public static function parseRemoteXML($url, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
|
||||
{
|
||||
$metadataInfo = array();
|
||||
|
||||
try {
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
|
||||
|
||||
$xml = curl_exec($ch);
|
||||
if ($xml !== false) {
|
||||
$metadataInfo = self::parseXML($xml, $entityId, $desiredNameIdFormat, $desiredSSOBinding, $desiredSLOBinding);
|
||||
} else {
|
||||
throw new Exception(curl_error($ch), curl_errno($ch));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new Exception('Error on parseRemoteXML. '.$e->getMessage());
|
||||
}
|
||||
return $metadataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IdP Metadata Info from File
|
||||
*
|
||||
* @param string $filepath File path
|
||||
* @param string $entityId Entity Id of the desired IdP, if no
|
||||
* entity Id is provided and the XML
|
||||
* metadata contains more than one
|
||||
* IDPSSODescriptor, the first is returned
|
||||
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
|
||||
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
|
||||
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
|
||||
*
|
||||
* @return array metadata info in php-saml settings format
|
||||
*/
|
||||
public static function parseFileXML($filepath, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
|
||||
{
|
||||
$metadataInfo = array();
|
||||
|
||||
try {
|
||||
if (file_exists($filepath)) {
|
||||
$data = file_get_contents($filepath);
|
||||
$metadataInfo = self::parseXML($data, $entityId, $desiredNameIdFormat, $desiredSSOBinding, $desiredSLOBinding);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new Exception('Error on parseFileXML. '.$e->getMessage());
|
||||
}
|
||||
return $metadataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IdP Metadata Info from URL
|
||||
*
|
||||
* @param string $xml XML that contains IdP metadata
|
||||
* @param string $entityId Entity Id of the desired IdP, if no
|
||||
* entity Id is provided and the XML
|
||||
* metadata contains more than one
|
||||
* IDPSSODescriptor, the first is returned
|
||||
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
|
||||
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
|
||||
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
|
||||
*
|
||||
* @return array metadata info in php-saml settings format
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function parseXML($xml, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
|
||||
{
|
||||
$metadataInfo = array();
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
try {
|
||||
$dom = Utils::loadXML($dom, $xml);
|
||||
if (!$dom) {
|
||||
throw new Exception('Error parsing metadata');
|
||||
}
|
||||
|
||||
$customIdPStr = '';
|
||||
if (!empty($entityId)) {
|
||||
$customIdPStr = '[@entityID="' . $entityId . '"]';
|
||||
}
|
||||
$idpDescryptorXPath = '//md:EntityDescriptor' . $customIdPStr . '/md:IDPSSODescriptor';
|
||||
|
||||
$idpDescriptorNodes = Utils::query($dom, $idpDescryptorXPath);
|
||||
|
||||
if (isset($idpDescriptorNodes) && $idpDescriptorNodes->length > 0) {
|
||||
$metadataInfo['idp'] = array();
|
||||
|
||||
$idpDescriptor = $idpDescriptorNodes->item(0);
|
||||
|
||||
if (empty($entityId) && $idpDescriptor->parentNode->hasAttribute('entityID')) {
|
||||
$entityId = $idpDescriptor->parentNode->getAttribute('entityID');
|
||||
}
|
||||
|
||||
if (!empty($entityId)) {
|
||||
$metadataInfo['idp']['entityId'] = $entityId;
|
||||
}
|
||||
|
||||
$ssoNodes = Utils::query($dom, './md:SingleSignOnService[@Binding="'.$desiredSSOBinding.'"]', $idpDescriptor);
|
||||
if ($ssoNodes->length < 1) {
|
||||
$ssoNodes = Utils::query($dom, './md:SingleSignOnService', $idpDescriptor);
|
||||
}
|
||||
if ($ssoNodes->length > 0) {
|
||||
$metadataInfo['idp']['singleSignOnService'] = array(
|
||||
'url' => $ssoNodes->item(0)->getAttribute('Location'),
|
||||
'binding' => $ssoNodes->item(0)->getAttribute('Binding')
|
||||
);
|
||||
}
|
||||
|
||||
$sloNodes = Utils::query($dom, './md:SingleLogoutService[@Binding="'.$desiredSLOBinding.'"]', $idpDescriptor);
|
||||
if ($sloNodes->length < 1) {
|
||||
$sloNodes = Utils::query($dom, './md:SingleLogoutService', $idpDescriptor);
|
||||
}
|
||||
if ($sloNodes->length > 0) {
|
||||
$metadataInfo['idp']['singleLogoutService'] = array(
|
||||
'url' => $sloNodes->item(0)->getAttribute('Location'),
|
||||
'binding' => $sloNodes->item(0)->getAttribute('Binding')
|
||||
);
|
||||
|
||||
if ($sloNodes->item(0)->hasAttribute('ResponseLocation')) {
|
||||
$metadataInfo['idp']['singleLogoutService']['responseUrl'] = $sloNodes->item(0)->getAttribute('ResponseLocation');
|
||||
}
|
||||
}
|
||||
|
||||
$keyDescriptorCertSigningNodes = Utils::query($dom, './md:KeyDescriptor[not(contains(@use, "encryption"))]/ds:KeyInfo/ds:X509Data/ds:X509Certificate', $idpDescriptor);
|
||||
|
||||
$keyDescriptorCertEncryptionNodes = Utils::query($dom, './md:KeyDescriptor[not(contains(@use, "signing"))]/ds:KeyInfo/ds:X509Data/ds:X509Certificate', $idpDescriptor);
|
||||
|
||||
if (!empty($keyDescriptorCertSigningNodes) || !empty($keyDescriptorCertEncryptionNodes)) {
|
||||
$metadataInfo['idp']['x509certMulti'] = array();
|
||||
if (!empty($keyDescriptorCertSigningNodes)) {
|
||||
$idpInfo['x509certMulti']['signing'] = array();
|
||||
foreach ($keyDescriptorCertSigningNodes as $keyDescriptorCertSigningNode) {
|
||||
$metadataInfo['idp']['x509certMulti']['signing'][] = Utils::formatCert($keyDescriptorCertSigningNode->nodeValue, false);
|
||||
}
|
||||
}
|
||||
if (!empty($keyDescriptorCertEncryptionNodes)) {
|
||||
$idpInfo['x509certMulti']['encryption'] = array();
|
||||
foreach ($keyDescriptorCertEncryptionNodes as $keyDescriptorCertEncryptionNode) {
|
||||
$metadataInfo['idp']['x509certMulti']['encryption'][] = Utils::formatCert($keyDescriptorCertEncryptionNode->nodeValue, false);
|
||||
}
|
||||
}
|
||||
|
||||
$idpCertdata = $metadataInfo['idp']['x509certMulti'];
|
||||
if ((count($idpCertdata) == 1 and
|
||||
((isset($idpCertdata['signing']) and count($idpCertdata['signing']) == 1) or (isset($idpCertdata['encryption']) and count($idpCertdata['encryption']) == 1))) or
|
||||
((isset($idpCertdata['signing']) && count($idpCertdata['signing']) == 1) && isset($idpCertdata['encryption']) && count($idpCertdata['encryption']) == 1 && strcmp($idpCertdata['signing'][0], $idpCertdata['encryption'][0]) == 0)) {
|
||||
if (isset($metadataInfo['idp']['x509certMulti']['signing'][0])) {
|
||||
$metadataInfo['idp']['x509cert'] = $metadataInfo['idp']['x509certMulti']['signing'][0];
|
||||
} else {
|
||||
$metadataInfo['idp']['x509cert'] = $metadataInfo['idp']['x509certMulti']['encryption'][0];
|
||||
}
|
||||
unset($metadataInfo['idp']['x509certMulti']);
|
||||
}
|
||||
}
|
||||
|
||||
$nameIdFormatNodes = Utils::query($dom, './md:NameIDFormat', $idpDescriptor);
|
||||
if ($nameIdFormatNodes->length > 0) {
|
||||
$metadataInfo['sp']['NameIDFormat'] = $nameIdFormatNodes->item(0)->nodeValue;
|
||||
if (!empty($desiredNameIdFormat)) {
|
||||
foreach ($nameIdFormatNodes as $nameIdFormatNode) {
|
||||
if (strcmp($nameIdFormatNode->nodeValue, $desiredNameIdFormat) == 0) {
|
||||
$metadataInfo['sp']['NameIDFormat'] = $nameIdFormatNode->nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new Exception('Error parsing metadata. '.$e->getMessage());
|
||||
}
|
||||
|
||||
return $metadataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject metadata info into php-saml settings array
|
||||
*
|
||||
* @param array $settings php-saml settings array
|
||||
* @param array $metadataInfo array metadata info
|
||||
*
|
||||
* @return array settings
|
||||
*/
|
||||
public static function injectIntoSettings($settings, $metadataInfo)
|
||||
{
|
||||
if (isset($metadataInfo['idp']) && isset($settings['idp'])) {
|
||||
if (isset($metadataInfo['idp']['x509certMulti']) && !empty($metadataInfo['idp']['x509certMulti']) && isset($settings['idp']['x509cert'])) {
|
||||
unset($settings['idp']['x509cert']);
|
||||
}
|
||||
|
||||
if (isset($metadataInfo['idp']['x509cert']) && !empty($metadataInfo['idp']['x509cert']) && isset($settings['idp']['x509certMulti'])) {
|
||||
unset($settings['idp']['x509certMulti']);
|
||||
}
|
||||
}
|
||||
|
||||
return array_replace_recursive($settings, $metadataInfo);
|
||||
}
|
||||
}
|
|
@ -1,492 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of php-saml.
|
||||
*
|
||||
* (c) OneLogin Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @package OneLogin
|
||||
* @author OneLogin Inc <saml-info@onelogin.com>
|
||||
* @license MIT https://github.com/onelogin/php-saml/blob/master/LICENSE
|
||||
* @link https://github.com/onelogin/php-saml
|
||||
*/
|
||||
|
||||
namespace OneLogin\Saml2;
|
||||
|
||||
use RobRichards\XMLSecLibs\XMLSecurityKey;
|
||||
|
||||
use DOMDocument;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* SAML 2 Logout Request
|
||||
*/
|
||||
class LogoutRequest
|
||||
{
|
||||
/**
|
||||
* Contains the ID of the Logout Request
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Object that represents the setting info
|
||||
*
|
||||
* @var Settings
|
||||
*/
|
||||
protected $_settings;
|
||||
|
||||
/**
|
||||
* SAML Logout Request
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_logoutRequest;
|
||||
|
||||
/**
|
||||
* After execute a validation process, this var contains the cause
|
||||
*
|
||||
* @var Exception
|
||||
*/
|
||||
private $_error;
|
||||
|
||||
/**
|
||||
* Constructs the Logout Request object.
|
||||
*
|
||||
* @param Settings $settings Settings
|
||||
* @param string|null $request A UUEncoded Logout Request.
|
||||
* @param string|null $nameId The NameID that will be set in the LogoutRequest.
|
||||
* @param string|null $sessionIndex The SessionIndex (taken from the SAML Response in the SSO process).
|
||||
* @param string|null $nameIdFormat The NameID Format will be set in the LogoutRequest.
|
||||
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
|
||||
* @param string|null $nameIdSPNameQualifier The NameID SP NameQualifier will be set in the LogoutRequest.
|
||||
*/
|
||||
public function __construct(\OneLogin\Saml2\Settings $settings, $request = null, $nameId = null, $sessionIndex = null, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
|
||||
{
|
||||
$this->_settings = $settings;
|
||||
|
||||
$baseURL = $this->_settings->getBaseURL();
|
||||
if (!empty($baseURL)) {
|
||||
Utils::setBaseURL($baseURL);
|
||||
}
|
||||
|
||||
if (!isset($request) || empty($request)) {
|
||||
$spData = $this->_settings->getSPData();
|
||||
$idpData = $this->_settings->getIdPData();
|
||||
$security = $this->_settings->getSecurityData();
|
||||
|
||||
$id = Utils::generateUniqueID();
|
||||
$this->id = $id;
|
||||
|
||||
$issueInstant = Utils::parseTime2SAML(time());
|
||||
|
||||
$cert = null;
|
||||
if (isset($security['nameIdEncrypted']) && $security['nameIdEncrypted']) {
|
||||
$existsMultiX509Enc = isset($idpData['x509certMulti']) && isset($idpData['x509certMulti']['encryption']) && !empty($idpData['x509certMulti']['encryption']);
|
||||
|
||||
if ($existsMultiX509Enc) {
|
||||
$cert = $idpData['x509certMulti']['encryption'][0];
|
||||
} else {
|
||||
$cert = $idpData['x509cert'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($nameId)) {
|
||||
if (empty($nameIdFormat)
|
||||
&& $spData['NameIDFormat'] != Constants::NAMEID_UNSPECIFIED) {
|
||||
$nameIdFormat = $spData['NameIDFormat'];
|
||||
}
|
||||
} else {
|
||||
$nameId = $idpData['entityId'];
|
||||
$nameIdFormat = Constants::NAMEID_ENTITY;
|
||||
}
|
||||
|
||||
/* From saml-core-2.0-os 8.3.6, when the entity Format is used:
|
||||
"The NameQualifier, SPNameQualifier, and SPProvidedID attributes MUST be omitted.
|
||||
*/
|
||||
if (!empty($nameIdFormat) && $nameIdFormat == Constants::NAMEID_ENTITY) {
|
||||
$nameIdNameQualifier = null;
|
||||
$nameIdSPNameQualifier = null;
|
||||
}
|
||||
|
||||
// NameID Format UNSPECIFIED omitted
|
||||
if (!empty($nameIdFormat) && $nameIdFormat == Constants::NAMEID_UNSPECIFIED) {
|
||||
$nameIdFormat = null;
|
||||
}
|
||||
|
||||
$nameIdObj = Utils::generateNameId(
|
||||
$nameId,
|
||||
$nameIdSPNameQualifier,
|
||||
$nameIdFormat,
|
||||
$cert,
|
||||
$nameIdNameQualifier
|
||||
);
|
||||
|
||||
$sessionIndexStr = isset($sessionIndex) ? "<samlp:SessionIndex>{$sessionIndex}</samlp:SessionIndex>" : "";
|
||||
|
||||
$spEntityId = htmlspecialchars($spData['entityId'], ENT_QUOTES);
|
||||
$logoutRequest = <<<LOGOUTREQUEST
|
||||
<samlp:LogoutRequest
|
||||
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
|
||||
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
|
||||
ID="{$id}"
|
||||
Version="2.0"
|
||||
IssueInstant="{$issueInstant}"
|
||||
Destination="{$idpData['singleLogoutService']['url']}">
|
||||
<saml:Issuer>{$spEntityId}</saml:Issuer>
|
||||
{$nameIdObj}
|
||||
{$sessionIndexStr}
|
||||
</samlp:LogoutRequest>
|
||||
LOGOUTREQUEST;
|
||||
} else {
|
||||
$decoded = base64_decode($request);
|
||||
// We try to inflate
|
||||
$inflated = @gzinflate($decoded);
|
||||
if ($inflated != false) {
|
||||
$logoutRequest = $inflated;
|
||||
} else {
|
||||
$logoutRequest = $decoded;
|
||||
}
|
||||
$this->id = static::getID($logoutRequest);
|
||||
}
|
||||
$this->_logoutRequest = $logoutRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Logout Request defated, base64encoded, unsigned
|
||||
*
|
||||
* @param bool|null $deflate Whether or not we should 'gzdeflate' the request body before we return it.
|
||||
*
|
||||
* @return string Deflated base64 encoded Logout Request
|
||||
*/
|
||||
public function getRequest($deflate = null)
|
||||
{
|
||||
$subject = $this->_logoutRequest;
|
||||
|
||||
if (is_null($deflate)) {
|
||||
$deflate = $this->_settings->shouldCompressRequests();
|
||||
}
|
||||
|
||||
if ($deflate) {
|
||||
$subject = gzdeflate($this->_logoutRequest);
|
||||
}
|
||||
|
||||
return base64_encode($subject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the Logout Request.
|
||||
*
|
||||
* @param string|DOMDocument $request Logout Request Message
|
||||
*
|
||||
* @return string ID
|
||||
*
|
||||
* @throws Error
|
||||
*/
|
||||
public static function getID($request)
|
||||
{
|
||||
if ($request instanceof DOMDocument) {
|
||||
$dom = $request;
|
||||
} else {
|
||||
$dom = new DOMDocument();
|
||||
$dom = Utils::loadXML($dom, $request);
|
||||
}
|
||||
|
||||
|
||||
if (false === $dom) {
|
||||
throw new Error(
|
||||
"LogoutRequest could not be processed",
|
||||
Error::SAML_LOGOUTREQUEST_INVALID
|
||||
);
|
||||
}
|
||||
|
||||
$id = $dom->documentElement->getAttribute('ID');
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the NameID Data of the the Logout Request.
|
||||
*
|
||||
* @param string|DOMDocument $request Logout Request Message
|
||||
* @param string|null $key The SP key
|
||||
*
|
||||
* @return array Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
|
||||
*
|
||||
* @throws Error
|
||||
* @throws Exception
|
||||
* @throws ValidationError
|
||||
*/
|
||||
public static function getNameIdData($request, $key = null)
|
||||
{
|
||||
if ($request instanceof DOMDocument) {
|
||||
$dom = $request;
|
||||
} else {
|
||||
$dom = new DOMDocument();
|
||||
$dom = Utils::loadXML($dom, $request);
|
||||
}
|
||||
|
||||
$encryptedEntries = Utils::query($dom, '/samlp:LogoutRequest/saml:EncryptedID');
|
||||
|
||||
if ($encryptedEntries->length == 1) {
|
||||
$encryptedDataNodes = $encryptedEntries->item(0)->getElementsByTagName('EncryptedData');
|
||||
$encryptedData = $encryptedDataNodes->item(0);
|
||||
|
||||
if (empty($key)) {
|
||||
throw new Error(
|
||||
"Private Key is required in order to decrypt the NameID, check settings",
|
||||
Error::PRIVATE_KEY_NOT_FOUND
|
||||
);
|
||||
}
|
||||
|
||||
$seckey = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type'=>'private'));
|
||||
$seckey->loadKey($key);
|
||||
|
||||
$nameId = Utils::decryptElement($encryptedData, $seckey);
|
||||
|
||||
} else {
|
||||
$entries = Utils::query($dom, '/samlp:LogoutRequest/saml:NameID');
|
||||
if ($entries->length == 1) {
|
||||
$nameId = $entries->item(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($nameId)) {
|
||||
throw new ValidationError(
|
||||
"NameID not found in the Logout Request",
|
||||
ValidationError::NO_NAMEID
|
||||
);
|
||||
}
|
||||
|
||||
$nameIdData = array();
|
||||
$nameIdData['Value'] = $nameId->nodeValue;
|
||||
foreach (array('Format', 'SPNameQualifier', 'NameQualifier') as $attr) {
|
||||
if ($nameId->hasAttribute($attr)) {
|
||||
$nameIdData[$attr] = $nameId->getAttribute($attr);
|
||||
}
|
||||
}
|
||||
|
||||
return $nameIdData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the NameID of the Logout Request.
|
||||
*
|
||||
* @param string|DOMDocument $request Logout Request Message
|
||||
* @param string|null $key The SP key
|
||||
*
|
||||
* @return string Name ID Value
|
||||
*
|
||||
* @throws Error
|
||||
* @throws Exception
|
||||
* @throws ValidationError
|
||||
*/
|
||||
public static function getNameId($request, $key = null)
|
||||
{
|
||||
$nameId = self::getNameIdData($request, $key);
|
||||
return $nameId['Value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Issuer of the Logout Request.
|
||||
*
|
||||
* @param string|DOMDocument $request Logout Request Message
|
||||
*
|
||||
* @return string|null $issuer The Issuer
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getIssuer($request)
|
||||
{
|
||||
if ($request instanceof DOMDocument) {
|
||||
$dom = $request;
|
||||
} else {
|
||||
$dom = new DOMDocument();
|
||||
$dom = Utils::loadXML($dom, $request);
|
||||
}
|
||||
|
||||
$issuer = null;
|
||||
$issuerNodes = Utils::query($dom, '/samlp:LogoutRequest/saml:Issuer');
|
||||
if ($issuerNodes->length == 1) {
|
||||
$issuer = $issuerNodes->item(0)->textContent;
|
||||
}
|
||||
return $issuer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SessionIndexes from the Logout Request.
|
||||
* Notice: Our Constructor only support 1 SessionIndex but this parser
|
||||
* extracts an array of all the SessionIndex found on a
|
||||
* Logout Request, that could be many.
|
||||
*
|
||||
* @param string|DOMDocument $request Logout Request Message
|
||||
*
|
||||
* @return array The SessionIndex value
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getSessionIndexes($request)
|
||||
{
|
||||
if ($request instanceof DOMDocument) {
|
||||
$dom = $request;
|
||||
} else {
|
||||
$dom = new DOMDocument();
|
||||
$dom = Utils::loadXML($dom, $request);
|
||||
}
|
||||
|
||||
$sessionIndexes = array();
|
||||
$sessionIndexNodes = Utils::query($dom, '/samlp:LogoutRequest/samlp:SessionIndex');
|
||||
foreach ($sessionIndexNodes as $sessionIndexNode) {
|
||||
$sessionIndexes[] = $sessionIndexNode->textContent;
|
||||
}
|
||||
return $sessionIndexes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Logout Request recieved is valid.
|
||||
*
|
||||
* @param bool $retrieveParametersFromServer True if we want to use parameters from $_SERVER to validate the signature
|
||||
*
|
||||
* @return bool If the Logout Request is or not valid
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws ValidationError
|
||||
*/
|
||||
public function isValid($retrieveParametersFromServer = false)
|
||||
{
|
||||
$this->_error = null;
|
||||
try {
|
||||
$dom = new DOMDocument();
|
||||
$dom = Utils::loadXML($dom, $this->_logoutRequest);
|
||||
|
||||
$idpData = $this->_settings->getIdPData();
|
||||
$idPEntityId = $idpData['entityId'];
|
||||
|
||||
if ($this->_settings->isStrict()) {
|
||||
$security = $this->_settings->getSecurityData();
|
||||
|
||||
if ($security['wantXMLValidation']) {
|
||||
$res = Utils::validateXML($dom, 'saml-schema-protocol-2.0.xsd', $this->_settings->isDebugActive(), $this->_settings->getSchemasPath());
|
||||
if (!$res instanceof DOMDocument) {
|
||||
throw new ValidationError(
|
||||
"Invalid SAML Logout Request. Not match the saml-schema-protocol-2.0.xsd",
|
||||
ValidationError::INVALID_XML_FORMAT
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$currentURL = Utils::getSelfRoutedURLNoQuery();
|
||||
|
||||
// Check NotOnOrAfter
|
||||
if ($dom->documentElement->hasAttribute('NotOnOrAfter')) {
|
||||
$na = Utils::parseSAML2Time($dom->documentElement->getAttribute('NotOnOrAfter'));
|
||||
if ($na <= time()) {
|
||||
throw new ValidationError(
|
||||
"Could not validate timestamp: expired. Check system clock.",
|
||||
ValidationError::RESPONSE_EXPIRED
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Check destination
|
||||
if ($dom->documentElement->hasAttribute('Destination')) {
|
||||
$destination = $dom->documentElement->getAttribute('Destination');
|
||||
if (empty($destination)) {
|
||||
if (!$security['relaxDestinationValidation']) {
|
||||
throw new ValidationError(
|
||||
"The LogoutRequest has an empty Destination value",
|
||||
ValidationError::EMPTY_DESTINATION
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$urlComparisonLength = $security['destinationStrictlyMatches'] ? strlen($destination) : strlen($currentURL);
|
||||
if (strncmp($destination, $currentURL, $urlComparisonLength) !== 0) {
|
||||
$currentURLNoRouted = Utils::getSelfURLNoQuery();
|
||||
$urlComparisonLength = $security['destinationStrictlyMatches'] ? strlen($destination) : strlen($currentURLNoRouted);
|
||||
if (strncmp($destination, $currentURLNoRouted, $urlComparisonLength) !== 0) {
|
||||
throw new ValidationError(
|
||||
"The LogoutRequest was received at $currentURL instead of $destination",
|
||||
ValidationError::WRONG_DESTINATION
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nameId = static::getNameId($dom, $this->_settings->getSPkey());
|
||||
|
||||
// Check issuer
|
||||
$issuer = static::getIssuer($dom);
|
||||
if (!empty($issuer) && $issuer != $idPEntityId) {
|
||||
throw new ValidationError(
|
||||
"Invalid issuer in the Logout Request",
|
||||
ValidationError::WRONG_ISSUER
|
||||
);
|
||||
}
|
||||
|
||||
if ($security['wantMessagesSigned'] && !isset($_GET['Signature'])) {
|
||||
throw new ValidationError(
|
||||
"The Message of the Logout Request is not signed and the SP require it",
|
||||
ValidationError::NO_SIGNED_MESSAGE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['Signature'])) {
|
||||
$signatureValid = Utils::validateBinarySign("SAMLRequest", $_GET, $idpData, $retrieveParametersFromServer);
|
||||
if (!$signatureValid) {
|
||||
throw new ValidationError(
|
||||
"Signature validation failed. Logout Request rejected",
|
||||
ValidationError::INVALID_SIGNATURE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
$this->_error = $e;
|
||||
$debug = $this->_settings->isDebugActive();
|
||||
if ($debug) {
|
||||
echo htmlentities($this->_error->getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* After execute a validation process, if fails this method returns the Exception of the cause
|
||||
*
|
||||
* @return Exception Cause
|
||||
*/
|
||||
public function getErrorException()
|
||||
{
|
||||
return $this->_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* After execute a validation process, if fails this method returns the cause
|
||||
*
|
||||
* @return null|string Error reason
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
$errorMsg = null;
|
||||
if (isset($this->_error)) {
|
||||
$errorMsg = htmlentities($this->_error->getMessage());
|
||||
}
|
||||
return $errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the XML that will be sent as part of the request
|
||||
* or that was received at the SP
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getXML()
|
||||
{
|
||||
return $this->_logoutRequest;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue