Skip to content

Commit

Permalink
Catching up development branch
Browse files Browse the repository at this point in the history
  • Loading branch information
justingreerbbi committed Feb 8, 2016
1 parent e3ab5de commit 5e08ac0
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 195 deletions.
4 changes: 2 additions & 2 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function license_status (){
add_action( 'wo_daily_tasks_hook', 'wo_daily_tasks' );
function wo_daily_tasks () {
$options = get_option( 'wo_options' );
if( $options['license_status'] == 'valid' ){
if( @$options['license_status'] == 'valid' ){
$api_params = array(
'edd_action'=> 'activate_license',
'license' => $options['license'],
Expand All @@ -136,7 +136,7 @@ function wo_daily_tasks () {
$response = wp_remote_get( add_query_arg( $api_params, 'https://wp-oauth.com' ) );
if ( !is_wp_error( $response ) ){
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
if($options['license_status'] == 'valid' && $license_data->license != 'valid') {
if(@$options['license_status'] == 'valid' && $license_data->license != 'valid') {
wp_mail( get_option('admin_email'), 'Issues found with WP OAuth Server', 'Recent checks show that your license key status for WordPress OAuth Server has been changed.');
$options['license'] = '';
$options['license_status'] = '';
Expand Down
85 changes: 0 additions & 85 deletions includes/rewrites.php

This file was deleted.

53 changes: 25 additions & 28 deletions library/class-wo-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* For now, you can read here to understand how this plugin works.
* @link(Github, http://bshaffer.github.io/oauth2-server-php-docs/)
*/
if (!function_exists('add_filter')) {
if (! function_exists( 'add_filter' ) ) {
header('Status: 403 Forbidden');
header('HTTP/1.1 403 Forbidden');
exit();
}

do_action('wo_before_api', array( $_REQUEST ) );
require_once dirname(__FILE__) . '/OAuth2/Autoloader.php';
do_action( 'wo_before_api', array( $_REQUEST ) );
require_once dirname( __FILE__ ) . '/OAuth2/Autoloader.php';
OAuth2\Autoloader::register();

// Grab the options
$o = get_option("wo_options");
if ($o["enabled"] == 0) {
if ( 0 == $o["enabled"] ) {
do_action('wo_before_unavailable_error');
$response = new OAuth2\Response(array('error' => 'temporarily_unavailable'));
$response->send();
Expand Down Expand Up @@ -47,7 +47,7 @@
'always_issue_new_refresh_token' => true,
'redirect_status_code' => 302
);
$server = new OAuth2\Server($storage, $config);
$server = new OAuth2\Server( $storage, $config );

/*
|--------------------------------------------------------------------------
Expand All @@ -59,25 +59,22 @@
|
*/
$support_grant_types = array();
if ($o['auth_code_enabled'] == '1') {
$server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage));
if ( '1' == $o['auth_code_enabled'] ) {
$server->addGrantType( new OAuth2\GrantType\AuthorizationCode( $storage ) );
}
if ($o['client_creds_enabled'] == '1') {
$server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
if ( '1' == $o['client_creds_enabled'] ) {
$server->addGrantType(new OAuth2\GrantType\ClientCredentials( $storage ) );
}
if ($o['user_creds_enabled'] == '1') {
$server->addGrantType(new OAuth2\GrantType\UserCredentials($storage));
if ( '1' == $o['user_creds_enabled'] ) {
$server->addGrantType(new OAuth2\GrantType\UserCredentials( $storage ) );
}
if ($o['refresh_tokens_enabled'] == '1') {
$server->addGrantType(new OAuth2\GrantType\RefreshToken($storage) );
if ( '1' == $o['refresh_tokens_enabled'] ) {
$server->addGrantType( new OAuth2\GrantType\RefreshToken( $storage, $config ) );
}
if ($o['use_openid_connect'] == '1') {
$server->addGrantType(new OAuth2\OpenID\GrantType\AuthorizationCode($storage, $config));
if ( '1' == $o['use_openid_connect'] ) {
$server->addGrantType( new OAuth2\OpenID\GrantType\AuthorizationCode( $storage, $config ) );
}

// JWT Bearer Token (not supported yet)
//$server->addGrantType(new OAuth2\GrantType\JwtBearer($storage, $config));

/*
|--------------------------------------------------------------------------
| DEFAULT SCOPES
Expand All @@ -89,14 +86,14 @@
|
*/
$defaultScope = 'basic';
$supportedScopes = apply_filters('wo_scopes', null, 20);
$supportedScopes = apply_filters( 'wo_scopes', null, 20 );

$memory = new OAuth2\Storage\Memory(array(
$memory = new OAuth2\Storage\Memory( array(
'default_scope' => $defaultScope,
'supported_scopes' => $supportedScopes,
));
$scopeUtil = new OAuth2\Scope($memory);
$server->setScopeUtil($scopeUtil);
) );
$scopeUtil = new OAuth2\Scope( $memory );
$server->setScopeUtil( $scopeUtil );

/*
|--------------------------------------------------------------------------
Expand All @@ -107,7 +104,7 @@
| Authorization Code (implicit) Grant Type as well as request tokens
|
*/
if ($method == 'token') {
if ( $method == 'token' ) {
do_action( 'wo_before_token_method', array( $_REQUEST ) );
$server->handleTokenRequest( OAuth2\Request::createFromGlobals() )->send();
exit;
Expand All @@ -126,11 +123,11 @@
| 3. Create the authorization request using the authentication user's user_id
|
*/
if ($method == 'authorize') {
do_action('wo_before_authorize_method', array( $_REQUEST ) );
if ( $method == 'authorize' ) {
do_action( 'wo_before_authorize_method', array( $_REQUEST ) );
$request = OAuth2\Request::createFromGlobals();
$response = new OAuth2\Response();
if (!$server->validateAuthorizeRequest( $request, $response ) ) {
if (! $server->validateAuthorizeRequest( $request, $response ) ) {
$response->send();
exit;
}
Expand All @@ -154,7 +151,7 @@
| @since 3.0.5
*/
if ($well_known == 'keys') {
$keys = apply_filters('wo_server_keys', null);
$keys = apply_filters( 'wo_server_keys', null);
$publicKey = openssl_pkey_get_public( file_get_contents( $keys['public'] ) );
$publicKey = openssl_pkey_get_details( $publicKey );
$response = new OAuth2\Response( array(
Expand Down
50 changes: 25 additions & 25 deletions library/keys/private_key.pem
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAoDMTSq9sNew0RLWIQV71JVY+nLydcXqoGfTyssveSNlNdQJ0
SL6g2Niwz2jOMCrtbq+EKUPyaEWrdUcLnq01pQk0mxFTpgos0Wr/xvcrvcGBwWex
++IttJI2sIHNgidq4S9BS+KTfe0kmtPr2Lul9fAm/8hXwV2dSmuwqc/BCFPVurGi
qiOOC4hRJkiT9dLKf2fx706WhhmCktOpj3kaqhF3HRXE1gUIQTtFyRan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BO
HKp/6wWoMiIGdhbW5XiMavOcz9WTM0623Eh6OIR02AtsLtGHcqvk8w4V1vDxA261
4NZ3Lgxfmc9KUWCPY7a5kF6gmowCP1z3rN+GlMIR3MAiLydjZBn7jX0CgYEA3TH0
y7LqJ287qOOplOf5wu1fKu7XWUGdLMDM7XNICIx1/c8CcRRvn+kQ8NKBlP/yfMKC
5JdVgj9TmyriukOx6rvs8B+VpSmDhlt2CkHMAtlWu92jT21SU8XPyFBU6CIqCjuV
vm//IOBmDUnfj4ZWAccxL1UY+f+UlRD4v2Cvj38CgYEAkDXlLqlAK9igwpppZjpi
TJY/wLwCFDcxhVpZMxhGvUk9hQHFwo7JVgKDumzVqsaShcvg+N23fSXFIu8mRlb/
x16hxwsPhnc4W8PaTD89QoWRb/Ms6rgzr53ZF7oS1120ioq875/s9NKjaEUh51w7
cscWpiSYW0qybPcxXDLuWWUCgYEAyFqRo1ih46pLXcUpO+mLP9cGlrrUcNKP7ZON
i58aJjQkRAuX6JlcKnpPj/L80Nus5vjA2xGAsINv1WLZD2J162rhSPcy8vFRYwfB
ObUzd3kpqO0vGaiqI5tPg9/PqJwZfD9Qebi0XTEk/vBlAXnquZ2VnYv1Ha01Bnji
92Y6Xz0CgYEAtZ/0jXSXC1Oj0LTfpweTi6B5EYnfwoSaxwCeDKrNvVUji2nRPIVe
E1bjujhGazYdK543LFEv36IgjL7muODhXZUZQ4R+5+OAasMmgadLc3z311m4mcVS
XGCl7bKJG4dTN48cmNmhr2Icaf6psTnlcvNEIgBajpfhWrhKTeJ6Akw=
-----END RSA PRIVATE KEY-----
14 changes: 7 additions & 7 deletions library/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoDMTSq9sNew0RLWIQV71
JVY+nLydcXqoGfTyssveSNlNdQJ0SL6g2Niwz2jOMCrtbq+EKUPyaEWrdUcLnq01
pQk0mxFTpgos0Wr/xvcrvcGBwWex++IttJI2sIHNgidq4S9BS+KTfe0kmtPr2Lul
9fAm/8hXwV2dSmuwqc/BCFPVurGiqiOOC4hRJkiT9dLKf2fx706WhhmCktOpj3ka
qhF3HRXE1gUIQTtFyRanEMsx3LI64AkgroL0cU0exctggrIk0hs8hswjfSw7zySR
uh2kNjNhNYx2Dl72w/27SlIyjf/fPaPWz5gl86VE5Wzj7+Tm3hJ1KgIb9deJDdmg
0QIDAQAB
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0B0sd82KRixVjpmB6aM4
skQxM6kfQs5zjMVUKaKf9Pol0dPOCKjki9pVjU17yX4HenCdsl0W5msQM7X/15SO
uUBUzp1Afmcz/ehh0/+98qfh3vkK7NXSlriOGHkmNOmy31/qY1I5hNLvsVmtuQ3d
X2okirPrGRPkqpVyF8CYeoHEiIE+7dhKbyLgSoMo6D7nXdBS8vNlNVAlsxfQg9Ep
rmjwgnKUbTQj3VdHHy4NuOwCNlT7zcDuYRMrb1OfKrpCTTvrEnPCsAiC7DPqRKP0
pOZa/O8YSbH5EikRSOuOAsAC5HC9ITFm1qzWkrBq0GweOqJ85hLi47CMyvl0AEcE
AwIDAQAB
-----END PUBLIC KEY-----
10 changes: 9 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: http://justin-greer.com/
Tags: OAuth2 Service, oauth2, OAuth provider, Provider, OAuth, OAuth client, Single Sign On, SSO, OpenID Connect, OIDC, OpenID, Connect
Requires at least: 4.3
Tested up to: 4.4.1
Stable tag: 3.1.94
Stable tag: 3.1.95
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -93,6 +93,14 @@ For any upgrade or modification, PLEASE PLEASE PLEASE make a full backup of your

== Changelog ==

= 3.1.96 =
* Minor Tweaks
* Now sends proper config to refresh token controller

= 3.1.95 =
* Removed ALTER query. There is no need and someone updating from older version will experience issues anyways. Step by step upgrading is required.
* Fixed issues when updating and options key is missing. This caused header errors that have full error reporting on.

= 3.1.94 =
* Updated generateAuthorizationCode() to use wp_generate_password()
* Fixed bug with expires_in not retuning as integer
Expand Down
Loading

0 comments on commit 5e08ac0

Please sign in to comment.