Permalink
Browse files

Fixing some more details.

  • Loading branch information...
1 parent 8172c22 commit 6ea49c4745fd9c202af55998161de8ff84576eee @danielbcorreia danielbcorreia committed Dec 31, 2011
Showing with 33 additions and 9 deletions.
  1. +24 −3 Config/routes.php
  2. +8 −5 Controller/OAuth2ServerAppController.php
  3. +1 −1 Controller/OAuth2ServerController.php
View
@@ -1,10 +1,31 @@
<?php
// GET /oauth/login
-Router::connect('/oauth/login', array('plugin' => 'o_auth2_server', 'controller' => 'o_auth2_server', 'action' => 'login', '[method]' => 'GET'));
+Router::connect('/oauth/login',
+ array(
+ 'plugin' => 'OAuth2Server',
+ 'controller' => 'OAuth2Server',
+ 'action' => 'login',
+ '[method]' => 'GET'
+ )
+);
// POST /oauth/authorize
-Router::connect('/oauth/authorize', array('plugin' => 'o_auth2_server', 'controller' => 'o_auth2_server', 'action' => 'authorize', '[method]' => 'POST'));
+Router::connect('/oauth/authorize',
+ array(
+ 'plugin' => 'OAuth2Server',
+ 'controller' => 'OAuth2Server',
+ 'action' => 'authorize',
+ '[method]' => 'POST'
+ )
+);
// POST /oauth/access_token
-Router::connect('/oauth/access_token', array('plugin' => 'o_auth2_server', 'controller' => 'o_auth2_server', 'action' => 'access_token', '[method]' => 'POST'));
+Router::connect('/oauth/access_token',
+ array(
+ 'plugin' => 'OAuth2Server',
+ 'controller' => 'OAuth2Server',
+ 'action' => 'access_token',
+ '[method]' => 'POST'
+ )
+);
@@ -1,26 +1,29 @@
<?php
+App::uses('AppController', 'Controller');
+App::uses('AuthComponent', 'Controller/Component');
+
// include plugin configuration
Configure::load('OAuth2Server.config');
class OAuth2ServerAppController extends AppController {
- var $components = array('OAuth2');
+ var $components = array('OAuth2Server.OAuth2', 'Auth');
var $helpers = array();
/**
* Dynamically set Auth component.
*/
function __construct() {
parent::__construct();
- $this->components[] = Configure::read('OAuth2Server.Auth.className');
+ //$this->components[] = Configure::read('OAuth2Server.Auth.className');
}
/**
* beforeFilter() callback.
* Configure Auth component.
*/
function beforeFilter() {
- $Auth = Configure::read('OAuth2Server.Auth.className');
- $this->$Auth->deny('*');
+ //$Auth = Configure::read('OAuth2Server.Auth.className');
+ $this->Auth->deny('*');
foreach (array_merge(array(
'loginAction' => array(
@@ -33,7 +36,7 @@ function beforeFilter() {
'authorize' => 'controller',
'allowedActions' => array('login', 'authorize', 'access_token')
), Configure::read('OAuth2Server.Auth')) as $k => $v) {
- $this->$Auth->{$k} = $v;
+ $this->Auth->{$k} = $v;
}
return parent::beforeFilter(); // bubble up
@@ -17,7 +17,7 @@ public function isAuthorized() {
*/
public function access_token() {
try {
- $this->OAuth2Lib->grant_access_token();
+ $this->OAuth2Lib->grantAccessToken();
} catch(Exception $e) {
$this->fail($e);
}

0 comments on commit 6ea49c4

Please sign in to comment.