summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/controller/userstoragescontrollertest.php
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-08-12 10:54:03 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-08-19 10:05:11 +0100
commit272a46ebe1a5e195a078dde74f5f2ad941923d9e (patch)
tree58ea576ad6362e465526c65e7a7cae14e5df7013 /apps/files_external/tests/controller/userstoragescontrollertest.php
parenta6a69ef1dfe1545e1362953803219ed6f28f71a5 (diff)
downloadnextcloud-server-272a46ebe1a5e195a078dde74f5f2ad941923d9e.tar.gz
nextcloud-server-272a46ebe1a5e195a078dde74f5f2ad941923d9e.zip
Authentication mechanisms for external storage backends
A backend can now specify generic authentication schemes that it supports, instead of specifying the parameters for its authentication method directly. This allows multiple authentication mechanisms to be implemented for a single scheme, providing altered functionality. This commit introduces the backend framework for this feature, and so at this point the UI will be broken as the frontend does not specify the required information. Terminology: - authentication scheme Parameter interface for the authentication method. A backend supporting the 'password' scheme accepts two parameters, 'user' and 'password'. - authentication mechanism Specific mechanism implementing a scheme. Basic mechanisms may forward configuration options directly to the backend, more advanced ones may lookup parameters or retrieve them from the session New dropdown selector for external storage configurations to select the authentication mechanism to be used. Authentication mechanisms can have visibilities, just like backends. The API was extended too to make it easier to add/remove visibilities. In addition, the concept of 'allowed visibility' has been introduced, so a backend/auth mechanism can force a maximum visibility level (e.g. Local storage type) that cannot be overridden by configuration in the web UI. An authentication mechanism is a fully instantiated implementation. This allows an implementation to have dependencies injected into it, e.g. an \OCP\IDB for database operations. When a StorageConfig is being prepared for mounting, the authentication mechanism implementation has manipulateStorage() called, which inserts the relevant authentication method options into the storage ready for mounting.
Diffstat (limited to 'apps/files_external/tests/controller/userstoragescontrollertest.php')
-rw-r--r--apps/files_external/tests/controller/userstoragescontrollertest.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/files_external/tests/controller/userstoragescontrollertest.php b/apps/files_external/tests/controller/userstoragescontrollertest.php
index 99825f26394..9f1a8df8d2e 100644
--- a/apps/files_external/tests/controller/userstoragescontrollertest.php
+++ b/apps/files_external/tests/controller/userstoragescontrollertest.php
@@ -53,10 +53,12 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$backend->method('isVisibleFor')
->with(BackendService::VISIBILITY_PERSONAL)
->willReturn(false);
+ $authMech = $this->getAuthMechMock();
$storageConfig = new StorageConfig(1);
$storageConfig->setMountPoint('mount');
$storageConfig->setBackend($backend);
+ $storageConfig->setAuthMechanism($authMech);
$storageConfig->setBackendOptions([]);
$this->service->expects($this->exactly(2))
@@ -70,6 +72,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$response = $this->controller->create(
'mount',
'\OC\Files\Storage\SMB',
+ '\Auth\Mechanism',
array(),
[],
[],
@@ -83,6 +86,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
1,
'mount',
'\OC\Files\Storage\SMB',
+ '\Auth\Mechanism',
array(),
[],
[],