Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -188,8 +188,9 @@ abstract class _OAuth2 extends \IPS\Login\Handler
|
||||
|
||||
if ( $this->grantType() === 'authorization_code' AND $this->pkceSupported === TRUE )
|
||||
{
|
||||
$_SESSION['codeVerifier'] = \IPS\Login::generateRandomString( 128 );
|
||||
$data['code_challenge'] = rtrim( strtr( base64_encode( pack( 'H*', hash( 'sha256', $_SESSION['codeVerifier'] ) ) ), '+/', '-_' ), '=' );
|
||||
$codeChallenge = \IPS\Login::generateRandomString( 128 );
|
||||
\IPS\Request::i()->setCookie('codeVerifier', $codeChallenge, ( new \IPS\DateTime )->add( new \DateInterval( 'PT10M' ) ) );
|
||||
$data['code_challenge'] = rtrim( strtr( base64_encode( pack( 'H*', hash( 'sha256', $codeChallenge ) ) ), '+/', '-_' ), '=' );
|
||||
$data['code_challenge_method'] = 'S256';
|
||||
}
|
||||
|
||||
@@ -588,13 +589,13 @@ abstract class _OAuth2 extends \IPS\Login\Handler
|
||||
|
||||
if( $this->pkceSupported === TRUE )
|
||||
{
|
||||
$post['code_verifier'] = $_SESSION['codeVerifier'];
|
||||
$post['code_verifier'] = \IPS\Request::i()->cookie['codeVerifier'] ?: NULL;
|
||||
}
|
||||
|
||||
$data = $this->_authenticatedRequest( $this->tokenEndpoint(), $post );
|
||||
|
||||
$response = $data->decodeJson();
|
||||
unset( $_SESSION['codeVerifier'] );
|
||||
\IPS\Request::i()->setCookie('codeVerifier', NULL );
|
||||
}
|
||||
catch( \RuntimeException $e )
|
||||
{
|
||||
@@ -845,11 +846,13 @@ abstract class _OAuth2 extends \IPS\Login\Handler
|
||||
*/
|
||||
public function showInUcp( \IPS\Member $member = NULL )
|
||||
{
|
||||
if ( !isset( $this->settings['show_in_ucp'] ) ) // Default to showing
|
||||
$return = parent::showInUcp( $member );
|
||||
|
||||
if ( $return and !isset( $this->settings['show_in_ucp'] ) ) // Default to showing
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return parent::showInUcp( $member );
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user