Skip to content

Instantly share code, notes, and snippets.

@kiall
Created August 21, 2011 04:38
Show Gist options
  • Save kiall/1160128 to your computer and use it in GitHub Desktop.
Save kiall/1160128 to your computer and use it in GitHub Desktop.
<?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 {
// Validation Regexs
const CLIENT_ID_REGEXP = "/^[a-z0-9-_]{3,32}$/i";
const RESPONSE_TYPE_REGEXP = "/^(token|code)$/";
// Response Types
const RESPONSE_TYPE_CODE = 'code';
const RESPONSE_TYPE_TOKEN = 'token';
// Grant Types
const GRANT_TYPE_AUTH_CODE = 'authorization_code';
const GRANT_TYPE_USER_CREDENTIALS = 'password';
const GRANT_TYPE_REFRESH_TOKEN = 'refresh_token';
// Token Types
const TOKEN_TYPE_BEARER = 'Bearer';
// Error Codes
const ERROR_INVALID_REQUEST = 'invalid_request';
const ERROR_INVALID_CLIENT = 'invalid_client';
const ERROR_UNAUTHORIZED_CLIENT = 'unauthorized_client';
const ERROR_REDIRECT_URI_MISMATCH = 'redirect_uri_mismatch';
const ERROR_ACCESS_DENIED = 'access_denied';
const ERROR_UNSUPPORTED_RESPONSE_TYPE = 'unsupported_response_type';
const ERROR_INVALID_SCOPE = 'invalid_scope';
public static $supported_response_types = array (
OAuth2::RESPONSE_TYPE_CODE,
OAuth2::RESPONSE_TYPE_TOKEN,
);
public static $supported_scopes = array('tests');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment