-
Notifications
You must be signed in to change notification settings - Fork 950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for authorization code grant with PKCE for distributed apps #1067
base: main
Are you sure you want to change the base?
Conversation
move handlers for code challenge from OIDC Authorization Controller to the base authorization controller, so that non-OIDC flows can leverage it as well Add mechanism to enforce PKCE code challenges for public clients Add mechanism to configure supported code challenge methods change code_verifier comparison to use hash_equals() to avoid timing attacks added tests for all PKCE code challenge flows
@@ -88,6 +99,8 @@ public function __construct(ClientInterface $clientStorage, array $responseTypes | |||
'require_exact_redirect_uri' => true, | |||
'redirect_status_code' => 302, | |||
'enforce_pkce' => false, | |||
'enforce_pkce_for_public_clients' => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ this should probably default to true for new installs, but that could be a breaking change for existing installs. Leaving this at false allows for releasing as a minor version. Would recommend defaulting to true for the next major version.
if ($this->clientStorage instanceof ClientCredentialsInterface) { | ||
$isPublic = $this->clientStorage->isPublicClient($client_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ not sure why there are two interfaces, but the property is only typed to the higher level one which doesn't have the method we need.
/** | ||
* @var mixed | ||
*/ | ||
protected $code_challenge; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ these properties and their behavior moved to the parent class
@@ -173,6 +173,8 @@ public function __construct($storage = array(), array $config = array(), array $ | |||
'require_exact_redirect_uri' => true, | |||
'allow_implicit' => false, | |||
'enforce_pkce' => false, | |||
'enforce_pkce_for_public_clients' => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ same comment about default value
@bshaffer any chance you could give this PR a glance? |
Add support for "Authorization Code Grant with PKCE" flow to allow distributed apps to securely authenticate with an OAuth server without needing to embed secrets within the distributed application, as these can be easily exposed by decompiling the application binaries.
Reference: