Compare commits
2 commits
0973cd31c3
...
33dd519029
Author | SHA1 | Date | |
---|---|---|---|
33dd519029 | |||
e32f37bc67 |
8 changed files with 37 additions and 39 deletions
|
@ -1,15 +1,10 @@
|
||||||
{
|
{
|
||||||
"minimum-stability": "dev",
|
|
||||||
"prefer-stable": true,
|
|
||||||
"require": {
|
"require": {
|
||||||
"flashwave/index": "dev-master"
|
"flashwave/index": "^0.2408.40014"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Oatmeal\\": "src"
|
"Oatmeal\\": "src"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"preferred-install": "dist"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
26
composer.lock
generated
26
composer.lock
generated
|
@ -4,34 +4,30 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "8be4aa570091b8e36082f761bd734626",
|
"content-hash": "d5cb22679bb951d16ca033d549b45f20",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "flashwave/index",
|
"name": "flashwave/index",
|
||||||
"version": "dev-master",
|
"version": "v0.2408.182001",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://patchii.net/flash/index.git",
|
"url": "https://patchii.net/flash/index.git",
|
||||||
"reference": "e4c8ed711e045cffe840ba10a239ede14b0b171f"
|
"reference": "5a1fdcccedf818897a3468d5457875fabfb2ce28"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"php": ">=8.1"
|
"php": ">=8.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "^1.10",
|
"phpstan/phpstan": "^1.11",
|
||||||
"phpunit/phpunit": "^10.2"
|
"phpunit/phpunit": "^11.2"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).",
|
"ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).",
|
||||||
"ext-sqlite3": "Support for the Index\\Data\\SQLite namespace."
|
"ext-sqlite3": "Support for the Index\\Data\\SQLite namespace."
|
||||||
},
|
},
|
||||||
"default-branch": true,
|
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
|
||||||
"index.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Index\\": "src"
|
"Index\\": "src"
|
||||||
}
|
}
|
||||||
|
@ -50,16 +46,14 @@
|
||||||
],
|
],
|
||||||
"description": "Composer package for the common library for my projects.",
|
"description": "Composer package for the common library for my projects.",
|
||||||
"homepage": "https://railgun.sh/index",
|
"homepage": "https://railgun.sh/index",
|
||||||
"time": "2024-04-10T23:40:14+00:00"
|
"time": "2024-08-18T20:01:21+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {
|
"stability-flags": [],
|
||||||
"flashwave/index": 20
|
"prefer-stable": false,
|
||||||
},
|
|
||||||
"prefer-stable": true,
|
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Oatmeal;
|
namespace Oatmeal;
|
||||||
|
|
||||||
use Index\Environment;
|
|
||||||
use Index\Data\DbTools;
|
|
||||||
|
|
||||||
define('OAT_STARTUP', microtime(true));
|
define('OAT_STARTUP', microtime(true));
|
||||||
define('OAT_ROOT', __DIR__);
|
define('OAT_ROOT', __DIR__);
|
||||||
define('OAT_DEBUG', is_file(OAT_ROOT . '/.debug'));
|
define('OAT_DEBUG', is_file(OAT_ROOT . '/.debug'));
|
||||||
|
@ -12,9 +9,9 @@ define('OAT_DIR_SOURCE', OAT_ROOT . '/src');
|
||||||
|
|
||||||
require_once OAT_ROOT . '/vendor/autoload.php';
|
require_once OAT_ROOT . '/vendor/autoload.php';
|
||||||
|
|
||||||
Environment::setDebug(OAT_DEBUG);
|
error_reporting(OAT_DEBUG ? -1 : 0);
|
||||||
mb_internal_encoding('utf-8');
|
mb_internal_encoding('UTF-8');
|
||||||
date_default_timezone_set('utc');
|
date_default_timezone_set('GMT');
|
||||||
|
|
||||||
$oatmeal = new OatmealContext((function() {
|
$oatmeal = new OatmealContext((function() {
|
||||||
$path = OAT_ROOT . '/.rng';
|
$path = OAT_ROOT . '/.rng';
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Oatmeal;
|
namespace Oatmeal;
|
||||||
|
|
||||||
use Index\XString;
|
use Index\{CSRFP,UriBase64,XString};
|
||||||
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
||||||
use Index\Security\CSRFP;
|
|
||||||
use Index\Serialisation\UriBase64;
|
|
||||||
|
|
||||||
final class AuthzCodeRoutes extends RouteHandler {
|
final class AuthzCodeRoutes extends RouteHandler {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -58,7 +56,7 @@ final class AuthzCodeRoutes extends RouteHandler {
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<span>Scope:</span>
|
<span>Scope:</span>
|
||||||
<input type=text name=scope required>
|
<input type=text name=scope>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -146,9 +144,10 @@ HTML;
|
||||||
$query = [
|
$query = [
|
||||||
'response_type' => 'code',
|
'response_type' => 'code',
|
||||||
'client_id' => $clientId,
|
'client_id' => $clientId,
|
||||||
'scope' => $scope,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if($scope !== '')
|
||||||
|
$query['scope'] = $scope;
|
||||||
if($redirectUri !== '')
|
if($redirectUri !== '')
|
||||||
$query['redirect_uri'] = $redirectUri;
|
$query['redirect_uri'] = $redirectUri;
|
||||||
if($state !== '')
|
if($state !== '')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Oatmeal;
|
namespace Oatmeal;
|
||||||
|
|
||||||
|
use Index\CSRFP;
|
||||||
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
||||||
use Index\Security\CSRFP;
|
|
||||||
|
|
||||||
final class ClientCredsRoutes extends RouteHandler {
|
final class ClientCredsRoutes extends RouteHandler {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Oatmeal;
|
namespace Oatmeal;
|
||||||
|
|
||||||
|
use Index\CSRFP;
|
||||||
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
||||||
use Index\Security\CSRFP;
|
|
||||||
|
|
||||||
final class DeviceCodeRoutes extends RouteHandler {
|
final class DeviceCodeRoutes extends RouteHandler {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -53,7 +53,7 @@ final class DeviceCodeRoutes extends RouteHandler {
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<span>Scope:</span>
|
<span>Scope:</span>
|
||||||
<input type=text name=scope required>
|
<input type=text name=scope>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -93,7 +93,10 @@ HTML;
|
||||||
$scope = (string)$content->getParam('scope');
|
$scope = (string)$content->getParam('scope');
|
||||||
|
|
||||||
$headers = [];
|
$headers = [];
|
||||||
$body = ['scope' => $scope];
|
$body = [];
|
||||||
|
|
||||||
|
if($scope !== '')
|
||||||
|
$body['scope'] = $scope;
|
||||||
|
|
||||||
if($clientSecret === '')
|
if($clientSecret === '')
|
||||||
$body['client_id'] = $clientId;
|
$body['client_id'] = $clientId;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Oatmeal;
|
namespace Oatmeal;
|
||||||
|
|
||||||
|
use Index\CSRFP;
|
||||||
use Index\Http\Routing\{HttpRouter,IRouter,IRouteHandler};
|
use Index\Http\Routing\{HttpRouter,IRouter,IRouteHandler};
|
||||||
use Index\Security\CSRFP;
|
|
||||||
|
|
||||||
class OatmealContext {
|
class OatmealContext {
|
||||||
private CSRFP $csrfp;
|
private CSRFP $csrfp;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Oatmeal;
|
namespace Oatmeal;
|
||||||
|
|
||||||
|
use Index\CSRFP;
|
||||||
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
|
||||||
use Index\Security\CSRFP;
|
|
||||||
|
|
||||||
final class RefreshTokenRoutes extends RouteHandler {
|
final class RefreshTokenRoutes extends RouteHandler {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -50,6 +50,12 @@ final class RefreshTokenRoutes extends RouteHandler {
|
||||||
<input type=password name=client_secret>
|
<input type=password name=client_secret>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>
|
||||||
|
<span>Scope:</span>
|
||||||
|
<input type=text name=scope>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>Authentication:</span>
|
<span>Authentication:</span>
|
||||||
<label>
|
<label>
|
||||||
|
@ -101,6 +107,7 @@ HTML;
|
||||||
$clientSecret = (string)$content->getParam('client_secret');
|
$clientSecret = (string)$content->getParam('client_secret');
|
||||||
$refreshToken = (string)$content->getParam('refresh_token');
|
$refreshToken = (string)$content->getParam('refresh_token');
|
||||||
$auth = (string)$content->getParam('auth');
|
$auth = (string)$content->getParam('auth');
|
||||||
|
$scope = (string)$content->getParam('scope');
|
||||||
|
|
||||||
$headers = [];
|
$headers = [];
|
||||||
$body = [
|
$body = [
|
||||||
|
@ -108,6 +115,9 @@ HTML;
|
||||||
'refresh_token' => $refreshToken,
|
'refresh_token' => $refreshToken,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if($scope !== '')
|
||||||
|
$body['scope'] = $scope;
|
||||||
|
|
||||||
if($clientSecret === '')
|
if($clientSecret === '')
|
||||||
$body['client_id'] = $clientId;
|
$body['client_id'] = $clientId;
|
||||||
elseif($auth === 'body' || ($auth !== 'header' && mt_rand(0, 10) > 5)) {
|
elseif($auth === 'body' || ($auth !== 'header' && mt_rand(0, 10) > 5)) {
|
||||||
|
|
Loading…
Reference in a new issue