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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
D
Docker
S
SegmentFault 最新的问题
博客园 - 聂微东
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
L
LangChain Blog
Vercel News
Vercel News
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
T
Threatpost
Scott Helme
Scott Helme
T
Tailwind CSS Blog
Latest news
Latest news
Stack Overflow Blog
Stack Overflow Blog
Blog — PlanetScale
Blog — PlanetScale
The Register - Security
The Register - Security
罗磊的独立博客
P
Proofpoint News Feed
腾讯CDC
S
Schneier on Security
雷峰网
雷峰网
A
About on SuperTechFans
T
Tenable Blog
F
Full Disclosure
Cyberwarzone
Cyberwarzone
博客园_首页
有赞技术团队
有赞技术团队
K
Kaspersky official blog

Feed of "schmarty/gem-diamond"

Marty McGuire opened issue <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/issues/2&#34;>schmarty/gem-diamond#2</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire commented on issue <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/issues/1&#34;>schmarty/gem-diamond#1</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> Marty McGuire pushed to <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond/src/branch/main&#34;>main</a> at <a href=&#34;https://git.schmarty.net/schmarty/gem-diamond&#34;>schmarty/gem-diamond</a> allow only active sites for previous/next!!!! · 799d586eb9 - gem-diamond - schmartea
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);