mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-09 17:32:40 +00:00
Fix identifier construction
This commit is contained in:
parent
1073707f9c
commit
2d78a59603
1 changed files with 16 additions and 13 deletions
|
@ -26,18 +26,21 @@ class Auth extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'auth' => ['GET' => "opLogin", 'POST' => "opCodeVerification"],
|
'auth' => ['GET' => "opLogin", 'POST' => "opCodeVerification"],
|
||||||
'token' => ['GET' => "opTokenVerification", 'POST' => "opIssueAccessToken"],
|
'token' => ['GET' => "opTokenVerification", 'POST' => "opIssueAccessToken"],
|
||||||
];
|
];
|
||||||
/** The minimal set of reserved URL characters which mus t be escaped when comparing user ID URLs */
|
/** The set of URL characters escaped by rawurlencode() which should be unescaped when constructing user ID URLs */
|
||||||
const USERNAME_ESCAPES = [
|
const USERNAME_UNESCAPES = [
|
||||||
'#' => "%23",
|
'%21' => "!",
|
||||||
'%' => "%25",
|
'%24' => "$",
|
||||||
'/' => "%2F",
|
'%26' => "&",
|
||||||
'?' => "%3F",
|
'%27' => "'",
|
||||||
];
|
'%28' => "(",
|
||||||
/** The minimal set of reserved URL characters which must be escaped in query values */
|
'%29' => ")",
|
||||||
const QUERY_ESCAPES = [
|
'%2A' => "*",
|
||||||
'#' => "%23",
|
'%2B' => "+",
|
||||||
'%' => "%25",
|
'%2C' => ",",
|
||||||
'&' => "%26",
|
'%3A' => ":",
|
||||||
|
'%3B' => ";",
|
||||||
|
'%3D' => "=",
|
||||||
|
'%40' => "@",
|
||||||
];
|
];
|
||||||
/** The acceptable media type of input for POST requests */
|
/** The acceptable media type of input for POST requests */
|
||||||
const ACCEPTED_TYPE = "application/x-www-form-urlencoded";
|
const ACCEPTED_TYPE = "application/x-www-form-urlencoded";
|
||||||
|
@ -101,7 +104,7 @@ class Auth extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
* variables; it may fail depending on server configuration
|
* variables; it may fail depending on server configuration
|
||||||
*/
|
*/
|
||||||
protected function buildIdentifier(ServerRequestInterface $req, string $user): string {
|
protected function buildIdentifier(ServerRequestInterface $req, string $user): string {
|
||||||
return $this->buildBaseURL($req)."u/".str_replace(array_keys(self::USERNAME_ESCAPES), array_values(self::USERNAME_ESCAPES), $user);
|
return $this->buildBaseURL($req)."u/".str_replace(array_keys(self::USERNAME_UNESCAPES), array_values(self::USERNAME_UNESCAPES), rawurlencode($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Matches an identity URL against its canoncial form
|
/** Matches an identity URL against its canoncial form
|
||||||
|
|
Loading…
Reference in a new issue