惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Palo Alto Networks Blog
AWS News Blog
AWS News Blog
Latest news
Latest news
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Vulnerabilities – Threatpost
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
C
CERT Recently Published Vulnerability Notes
T
Tenable Blog
雷峰网
雷峰网
K
Kaspersky official blog
人人都是产品经理
人人都是产品经理
C
Cybersecurity and Infrastructure Security Agency CISA
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
T
Tor Project blog
A
Arctic Wolf
Project Zero
Project Zero
F
Fortinet All Blogs
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
P
Privacy & Cybersecurity Law Blog
D
DataBreaches.Net
量子位
Cisco Talos Blog
Cisco Talos Blog
博客园 - 【当耐特】
V
Visual Studio Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - 叶小钗
I
Intezer
G
GRAHAM CLULEY
Google Online Security Blog
Google Online Security Blog
T
The Blog of Author Tim Ferriss
T
Troy Hunt's Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Hacker News: Ask HN
Hacker News: Ask HN
M
MIT News - Artificial intelligence
N
News | PayPal Newsroom
Cyberwarzone
Cyberwarzone
V
V2EX
腾讯CDC
Webroot Blog
Webroot Blog
MongoDB | Blog
MongoDB | Blog

Feed of "schmarty/gem-diamond"

issue when using indieauth[dot]com? gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond proxy for profile images gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond gem-diamond
gem-diamond
schmarty · 2025-02-02 · via Feed of "schmarty/gem-diamond"

共有 2 个文件被更改,包括 93 次插入25 次删除

@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
namespace App\IndieAuth;
use IndieAuth\Client as IndieAuthClient;
class Client extends IndieAuthClient {
/**
* Start the authorization process. Discovers the user's auth
* endpoints (or falls back to indielogin.com).
* Reverses IndieAuth\Client behavior where `$authorizationEndpoint` arg
* takes precedence over user's configured auth endpoint. In this case, it's
* the fallback.
* I'm sure this reversal won't cause any future confusion or issues. 🙃
*/
public static function begin($url, $scope=false, $fallbackAuthorizationEndpoint=false) {
if(!isset(self::$clientID) || !isset(self::$redirectURL)) {
return self::_errorResponse(
'not_configured',
'Before you can begin, you need to configure the clientID and redirectURL of the IndieAuth client'
);
}
$errorCode = false;
$url = self::normalizeMeURL($url);
$_SESSION['indieauth_entered_url'] = $url;
if(!$url) {
return self::_errorResponse('invalid_url', 'The URL provided was invalid');
}
$metadataEndpoint = self::discoverMetadataEndpoint($url);
if ($metadataEndpoint) {
$response = self::discoverIssuer($metadataEndpoint);
if ($response instanceof ErrorResponse) {
return $response->getArray();
}
$_SESSION['indieauth_issuer'] = $response;
}
$authorizationEndpoint = static::discoverAuthorizationEndpoint($url);
if((!$authorizationEndpoint) && (!$fallbackAuthorizationEndpoint)) {
// didn't find an auth endpoint and no fallback passed in. we're stuck.
return self::_errorResponse('missing_authorization_endpoint', 'Could not find your authorization endpoint');
}
$authorizationEndpoint = $fallbackAuthorizationEndpoint;
$scopes = self::parseNonProfileScopes($scope);
if(count($scopes)) {
$tokenEndpoint = static::discoverTokenEndpoint($url);
if(!$tokenEndpoint) {
return self::_errorResponse(
'missing_token_endpoint',
'Could not find your token endpoint. The token endpoint is required when requesting non-profile scopes'
);
}
}
$state = self::generateStateParameter();
$codeVerifier = self::generatePKCECodeVerifier();
$_SESSION['indieauth_state'] = $state;
$_SESSION['indieauth_code_verifier'] = $codeVerifier;
$_SESSION['indieauth_authorization_endpoint'] = $authorizationEndpoint;
if(isset($tokenEndpoint)) {
$_SESSION['indieauth_token_endpoint'] = $tokenEndpoint;
}
$authorizationURL = self::buildAuthorizationURL($authorizationEndpoint, [
'me' => $url,
'redirect_uri' => self::$redirectURL,
'client_id' => self::$clientID,
'state' => $state,
'code_verifier' => $codeVerifier,
'scope' => $scope,
]);
return [$authorizationURL, false];
}
}
@ -5,6 +5,8 @@ namespace App;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use App\IndieAuth;
class IndieAuthController extends \Schmarty\Micropubkit\IndieAuthController {
/**
@ -20,34 +22,12 @@ class IndieAuthController extends \Schmarty\Micropubkit\IndieAuthController {
return $this->error_redirect('missing_url', 'Website URL is required');
}
$url = \IndieAuth\Client::normalizeMeURL($params['me']);
$url = $params['me'];
list($authorizationURL, $error) = \IndieAuth\Client::begin($url, $this->scopes);
list($authorizationURL, $error) = IndieAuth\Client::begin($url, $this->scopes, 'https://indielogin.com/auth');
if($error) {
// use indielogin instead
// NOTE: this duplicates a _bunch_ of \IndieAuth\Client::begin. Smells like
// a refactor maybe?
$state = \IndieAuth\Client::generateStateParameter();
$codeVerifier = \IndieAuth\Client::generatePKCECodeVerifier();
// set up session info so \IndieAuth\Client can find it later
$_SESSION['indieauth_entered_url'] = $url;
$_SESSION['indieauth_state'] = $state;
$_SESSION['indieauth_code_verifier'] = $codeVerifier;
$_SESSION['indieauth_authorization_endpoint'] = 'https://indielogin.com/auth';
$authorizationURL = \IndieAuth\Client::buildAuthorizationURL(
"https://indielogin.com/auth",
[
'me' => $url,
'redirect_uri' => \IndieAuth\Client::$redirectURL,
'client_id' => \IndieAuth\Client::$clientID,
'code_verifier' => $codeVerifier,
'state' => $state,
]
);
return $this->error_redirect($error['error'], $error['error_description']);
}
return $this->response->withHeader('Location', $authorizationURL)->withStatus(302);