Skip to content

Instantly share code, notes, and snippets.

View kiall's full-sized avatar

Kiall Mac Innes kiall

  • Microsoft
  • Dublin, Ireland
View GitHub Profile
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
@kiall
kiall / bla.php
Created August 20, 2011 16:02
Valid::at_least()
<?php defined('SYSPATH') or die('No direct script access.');
class Model_Bla extends ORM {
public function rules()
{
return array(
'phone_one' => array(
array('at_least', array($this, 1, array('phone_one', 'phone_two', 'phone_three'))),
),
object Validation(6) {
protected _bound => array(4) (
":validation" => object Validation(6) {
*RECURSION*
}
":data" => array(5) (
"client_id" => string(4) "test"
"response_type" => string(4) "code"
"redirect_uri" => string(30) "http://wk01-lmst.managedit.ie/"
"state" => NULL
if ($request->method() == Request::GET)
{
// Basic Request Validation
$params = $this->_get_authorize_params($request);
$validation = Validation::factory($params)
->rule('client_id', 'not_empty')
->rule('client_id', 'regex', array(':value', OAuth2::CLIENT_ID_REGEXP))
->rule('response_type', 'not_empty')
->rule('response_type', 'regex', array(':value', OAuth2::RESPONSE_TYPE_REGEXP))
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
*
* @package OAuth2
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
*/
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
*
* @package OAuth2
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
*/
class OAuth2 {
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
*
* @package OAuth2
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
*/
/oauth2/authorize?response_type=code&client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URI]
/oauth2/authorize?response_type=token&client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URI]
/oauth2/token?client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&redirect_uri=[REDIRECT_URI]&grant_type=authorization_code&code=[CODE]
/oauth2/token?client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&redirect_uri=[REDIRECT_URI]&grant_type=refresh_token&refresh_token=[REFRESH_TOKEN]
/protected/resource?client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&access_token=[ACCESS_TOKEN]
<?php defined('SYSPATH') or die('No direct script access.');
/**
*
* @package API
* @category Library
* @author Managed I.T.
* @copyright (c) 2011 Managed I.T.
* @license https://github.com/managedit/kohana-api/blob/master/LICENSE.md
*/
#!/usr/bin/env ruby
require 'rubygems'
require 'oauth2'
require 'pp'
client = OAuth2::Client.new('test', 'test', :site => 'http://localhost/', :authorize_url => 'http://localhost/oauth2/authorize', :token_url => 'http://localhost/oauth2/token')
puts client.auth_code.authorize_url(:redirect_uri => 'http://localhost/')
puts "And the code is?"