aboutsummaryrefslogtreecommitdiff
path: root/appinfo
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-08-18 23:54:32 +0200
committerChristian Weiske <cweiske@cweiske.de>2014-08-18 23:54:32 +0200
commitdb2f09d46ce2f3a46be1b6f6e031492966242025 (patch)
tree4e22eba650c022936a4071afd9b2b0ee417ad34b /appinfo
parent3780cf15a59c48b3d71e8ec27e3bdacd8a119460 (diff)
downloadgrauphel-db2f09d46ce2f3a46be1b6f6e031492966242025.tar.gz
grauphel-db2f09d46ce2f3a46be1b6f6e031492966242025.zip
oauth dance works
Diffstat (limited to 'appinfo')
-rw-r--r--appinfo/application.php25
-rw-r--r--appinfo/routes.php12
2 files changed, 26 insertions, 11 deletions
diff --git a/appinfo/application.php b/appinfo/application.php
index ecee129..7a1691d 100644
--- a/appinfo/application.php
+++ b/appinfo/application.php
@@ -1,6 +1,7 @@
<?php
namespace OCA\Grauphel\AppInfo;
use \OCP\AppFramework\App;
+use \OCA\Grauphel\Lib\Dependencies;
class Application extends App
{
@@ -10,12 +11,21 @@ class Application extends App
$container = $this->getContainer();
+ $container->registerService(
+ 'Session',
+ function($c) {
+ return $c->query('ServerContainer')->getUserSession();
+ }
+ );
+
/**
* Controllers
*/
$container->registerService(
- 'ApiController',
+ 'ApiController',
function($c) {
+ Dependencies::get()->urlGen
+ = $c->query('ServerContainer')->getURLGenerator();
return new \OCA\Grauphel\Controller\ApiController(
$c->query('AppName'),
$c->query('Request')
@@ -23,8 +33,10 @@ class Application extends App
}
);
$container->registerService(
- 'AccessController',
+ 'AccessController',
function($c) {
+ Dependencies::get()->urlGen
+ = $c->query('ServerContainer')->getURLGenerator();
return new \OCA\Grauphel\Controller\AccessController(
$c->query('AppName'),
$c->query('Request')
@@ -32,11 +44,14 @@ class Application extends App
}
);
$container->registerService(
- 'OAuthController',
+ 'OauthController',
function($c) {
- return new \OCA\Grauphel\Controller\OAuthController(
+ Dependencies::get()->urlGen
+ = $c->query('ServerContainer')->getURLGenerator();
+ return new \OCA\Grauphel\Controller\OauthController(
$c->query('AppName'),
- $c->query('Request')
+ $c->query('Request'),
+ $c->query('Session')->getUser()
);
}
);
diff --git a/appinfo/routes.php b/appinfo/routes.php
index da62dc9..5567670 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -14,13 +14,8 @@ $application->registerRoutes(
array(
'url' => '/authorize',
'name' => 'access#authorize',
- 'verb' => 'GET',
- ),/*
- array(
- 'url' => '/authorize',
- 'name' => 'access#authorize',
'verb' => 'POST',
- ),*/
+ ),
array(
'url' => '/login',
'name' => 'access#login',
@@ -38,6 +33,11 @@ $application->registerRoutes(
'verb' => 'GET',
),
array(
+ 'url' => '/oauth/confirm',
+ 'name' => 'oauth#confirm',
+ 'verb' => 'POST',
+ ),
+ array(
'url' => '/oauth/request_token',
'name' => 'oauth#requestToken',
'verb' => 'POST',