diff options
author | Tom Needham <tom@owncloud.com> | 2012-07-30 10:25:41 +0000 |
---|---|---|
committer | Tom Needham <tom@owncloud.com> | 2012-07-30 10:25:41 +0000 |
commit | 5933d4390107224071f8265afd81222b69f98de7 (patch) | |
tree | 9b792bf12b920b705d82d384b5f61e05e269619a /settings | |
parent | 038af7e636ad8a2dc9ac342eaecd176cc5c35256 (diff) | |
download | nextcloud-server-5933d4390107224071f8265afd81222b69f98de7.tar.gz nextcloud-server-5933d4390107224071f8265afd81222b69f98de7.zip |
Basic template for authorising exernal apps with OAuth
Diffstat (limited to 'settings')
-rw-r--r-- | settings/oauth.php | 41 | ||||
-rw-r--r-- | settings/templates/oauth.php | 19 |
2 files changed, 60 insertions, 0 deletions
diff --git a/settings/oauth.php b/settings/oauth.php new file mode 100644 index 00000000000..bcf34b04af6 --- /dev/null +++ b/settings/oauth.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright (c) 2012, Tom Needham <tom@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + +require_once('../lib/base.php'); + +// Logic +$operation = isset($_GET['operation']) ? $_GET['operation'] : ''; +switch($operation){ + + case 'register': + + break; + + case 'request_token': + break; + + case 'authorise'; + // Example + $consumer = array( + 'name' => 'Firefox Bookmark Sync', + 'scopes' => array('bookmarks'), + ); + + $t = new OC_Template('settings', 'oauth', 'guest'); + $t->assign('consumer', $consumer); + $t->printPage(); + break; + + case 'access_token'; + break; + + default: + // Something went wrong + header('Location: /'); + break; + +} diff --git a/settings/templates/oauth.php b/settings/templates/oauth.php new file mode 100644 index 00000000000..ce2584365b9 --- /dev/null +++ b/settings/templates/oauth.php @@ -0,0 +1,19 @@ +<?php +/** + * Copyright (c) 2012, Tom Needham <tom@owncloud.com> + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ +?> + +<p><strong><?php echo $_['consumer']['name']; ?></strong> is requesting permission to read, write, modify and delete data from the following apps:</p> +<ul> + <?php + // Foreach requested scope + foreach($_['consumer']['scopes'] as $app){ + echo '<li>'.$app.'</li>'; + } + ?> +</ul> +<button>Disallow</button> +<button>Allow</button>
\ No newline at end of file |