diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-09-20 09:42:52 +0200 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-09-20 09:42:52 +0200 |
commit | 04972c611830d355dff97468564a941876aeeb3f (patch) | |
tree | 247e2d5fdcada8d9ba1d204962d7a4c47260382c | |
parent | 4ee727060a397c68d5512e2b6c042f6dd825b733 (diff) |
OAuth2+test
47 files changed, 4390 insertions, 76 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..f6400d9c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ + +\.idea/ + +vendor/ diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100644 index 00000000..bc36b6e8 --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,37 @@ +<?php +declare(strict_types=1); + + +/** + * Nextcloud - Social Support + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Maxence Lange <maxence@artificial-owl.com> + * @copyright 2018, Maxence Lange <maxence@artificial-owl.com> + * @license GNU AGPL version 3 or any later version + * + * 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/>. + * + */ + +namespace OCA\Social\AppInfo; + +require_once __DIR__ . '/autoload.php'; +require_once(__DIR__ . '/../lib/autoload.php'); + +//$app = new Application(); +//$app->registerNavigation(); + diff --git a/appinfo/autoload.php b/appinfo/autoload.php new file mode 100644 index 00000000..586cecf3 --- /dev/null +++ b/appinfo/autoload.php @@ -0,0 +1,38 @@ +<?php +declare(strict_types=1); + + +/** + * Nextcloud - Social Support + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Maxence Lange <maxence@artificial-owl.com> + * @copyright 2018, Maxence Lange <maxence@artificial-owl.com> + * @license GNU AGPL version 3 or any later version + * + * 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/>. + * + */ + + +namespace OCA\Social\AppInfo; + +$composerDir = __DIR__ . '/../vendor/'; + +if (is_dir($composerDir) && file_exists($composerDir . 'autoload.php')) { + require_once $composerDir . 'autoload.php'; +} + diff --git a/appinfo/database.xml b/appinfo/database.xml new file mode 100644 index 00000000..4ee64cb4 --- /dev/null +++ b/appinfo/database.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<database> + <name>*dbname*</name> + <create>true</create> + <overwrite>false</overwrite> + <charset>utf8</charset> + + <table> + <name>*dbprefix*social_services</name> + <declaration> + <field> + <name>id</name> + <type>integer</type> + <length>7</length> + <unsigned>true</unsigned> + <notnull>true</notnull> + <autoincrement>true</autoincrement> + <primary>true</primary> + </field> + + <field> + <name>type</name> + <type>text</type> + <length>15</length> + </field> + + <field> + <name>address</name> + <type>text</type> + <length>128</length> + </field> + + <field> + <name>config</name> + <type>text</type> + <length>3000</length> + </field> + + <field> + <name>status</name> + <type>integer</type> + <length>1</length> + </field> + + <field> + <name>creation</name> + <type>timestamp</type> + </field> + + </declaration> + </table> + + <table> + <name>*dbprefix*social_accounts</name> + <declaration> + + <field> + <name>id</name> + <type>integer</type> + <length>7</length> + <unsigned>true</unsigned> + <notnull>true</notnull> + <autoincrement>true</autoincrement> + <primary>true</primary> + </field> + + <field> + <name>service_id</name> + <type>integer</type> + <length>7</length> + <notnull>true</notnull> + </field> + + <field> + <name>user_id</name> + <type>text</type> + <length>63</length> + </field> + + <field> + <name>account</name> + <type>text</type> + <length>127</length> + </field> + + <field> + <name>status</name> + <type>integer</type> + <length>1</length> + </field> + + <field> + <name>auth</name> + <type>text</type> + <length>2000</length> + </field> + + <field> + <name>config</name> + <type>text</type> + <length>2000</length> + </field> + + <field> + <name>creation</name> + <type>timestamp</type> + </field> + + </declaration> + </table> + +</database> + diff --git a/appinfo/info.xml b/appinfo/info.xml index 3e339505..e232b247 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,24 +1,29 @@ <?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>social</id> - <name>Social</name> - <summary>🎉 Nextcloud becomes part of the federated social networks!</summary> - <description><![CDATA[test]]></description> - <version>0.0.1</version> - <licence>agpl</licence> - <author mail="jus@bitgrid.net" >Julius Härtl</author> - <author mail="hey@jancborchardt.net" homepage="https://jancborchardt.net">Jan-Christoph Borchardt</author> - <namespace>Social</namespace> - <category>social</category> - <bugs>https://github.com/nextcloud/social</bugs> - <dependencies> - <nextcloud min-version="14" max-version="15"/> - </dependencies> - <navigations> - <navigation> - <name>Social</name> - <route>social.page.index</route> - </navigation> - </navigations> +<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> + <id>social</id> + <name>Social</name> + <summary>🎉 Nextcloud becomes part of the federated social networks!</summary> + <description><![CDATA[test]]></description> + <version>0.0.9</version> + <licence>agpl</licence> + <author mail="maxence@artificial-owl.com">Maxence Lange</author> + <author mail="jus@bitgrid.net">Julius Härtl</author> + <author mail="hey@jancborchardt.net" homepage="https://jancborchardt.net">Jan-Christoph Borchardt</author> + <namespace>Social</namespace> + <category>social</category> + <website>https://github.com/nextcloud/social</website> + <repository type="git">https://github.com/nextcloud/social.git</repository> + <bugs>https://github.com/nextcloud/social/issues</bugs> + <screenshot>https://raw.githubusercontent.com/nextcloud/social/master/screenshots/screenshot.png</screenshot> + <dependencies> + <nextcloud min-version="14" max-version="15"/> + </dependencies> + <navigations> + <navigation> + <name>Social</name> + <route>social.Navigation.navigate</route> + </navigation> + </navigations> + </info> diff --git a/appinfo/routes.php b/appinfo/routes.php index d463e957..e0f7a657 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -8,8 +8,29 @@ * it's instantiated in there */ return [ - 'routes' => [ - ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], - ['name' => 'page#mail', 'url' => '/mail', 'verb' => 'GET'], - ] + 'routes' => [ + ['name' => 'Navigation#navigate', 'url' => '/', 'verb' => 'GET'], + + [ + 'name' => 'ServiceAccounts#getAvailableAccounts', 'url' => '/user/accounts', + 'verb' => 'GET' + ], + [ + 'name' => 'ServiceAccounts#create', 'url' => '/user/account', + 'verb' => 'POST' + ], + [ + 'name' => 'ActivityStreams#test', 'url' => '/user/account/{accountId}/test', + 'verb' => 'GET' + ], + +// [ +// 'name' => 'OAuth2#getAuthUrl', 'url' => '/client/oauth2/auth/{serviceId}/', +// 'verb' => 'GET' +// ], + [ + 'name' => 'OAuth2#setCode', 'url' => '/client/oauth2/redirect/{serviceId}/', + 'verb' => 'GET' + ] + ] ]; diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..4969f567 --- /dev/null +++ b/composer.json @@ -0,0 +1,16 @@ +{ + "name": "vendor_name/package_name", + "description": "description_text", + "minimum-stability": "stable", + "license": "proprietary", + "authors": [ + { + "name": "author's name", + "email": "email@example.com" + } + ], + "require": { + "league/oauth2-client": "2.3.0", + "lrf141/oauth2-mastodon": "1.0.1" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..10217eb8 --- /dev/null +++ b/composer.lock @@ -0,0 +1,422 @@ +{ + "_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" + ], + "content-hash": "61a7838c51e287d8fb6c226460fd4e2c", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2017-03-20T17:10:46+00:00" + }, + { + "name": "league/oauth2-client", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/oauth2-client.git", + "reference": "aa2e3df188f0bfd87f7880cc880e906e99923580" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/aa2e3df188f0bfd87f7880cc880e906e99923580", + "reference": "aa2e3df188f0bfd87f7880cc880e906e99923580", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "paragonie/random_compat": "^1|^2", + "php": "^5.6|^7.0" + }, + "require-dev": { + "eloquent/liberator": "^2.0", + "eloquent/phony-phpunit": "^1.0|^3.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phpunit/phpunit": "^5.7|^6.0", + "squizlabs/php_codesniffer": "^2.3|^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\OAuth2\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Bilbie", + "email": "hello@alexbilbie.com", + "homepage": "http://www.alexbilbie.com", + "role": "Developer" + }, + { + "name": "Woody Gilk", + "homepage": "https://github.com/shadowhand", + "role": "Contributor" + } + ], + "description": "OAuth 2.0 Client Library", + "keywords": [ + "Authentication", + "SSO", + "authorization", + "identity", + "idp", + "oauth", + "oauth2", + "single sign on" + ], + "time": "2018-01-13T05:27:58+00:00" + }, + { + "name": "lrf141/oauth2-mastodon", + "version": "1.0.1", + "source": { + "type": "git", + |