-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'imp_6_2' into signatures
- Loading branch information
Showing
47 changed files
with
776 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
framework/Imap_Client/lib/Horde/Imap/Client/Password/Xoauth2.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* Copyright 2013 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (LGPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/lgpl21. | ||
* | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
*/ | ||
|
||
/** | ||
* Generates an OAuth 2.0 authentication token as used in the Gmail XOAUTH2 | ||
* authentication mechanism. | ||
* | ||
* See: https://developers.google.com/gmail/xoauth2_protocol | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2013 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
* @since 2.16.0 | ||
*/ | ||
class Horde_Imap_Client_Password_Xoauth2 | ||
implements Horde_Imap_Client_Base_Password | ||
{ | ||
/** | ||
* Access token. | ||
* | ||
* @var string | ||
*/ | ||
public $access_token; | ||
|
||
/** | ||
* Username. | ||
* | ||
* @var string | ||
*/ | ||
public $username; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $username The username. | ||
* @param string $access_token The access token. | ||
*/ | ||
public function __construct($username, $access_token) | ||
{ | ||
$this->username = $username; | ||
$this->access_token = $access_token; | ||
} | ||
|
||
/** | ||
* Return the password to use for the server connection. | ||
* | ||
* @return string The password. | ||
*/ | ||
public function getPassword() | ||
{ | ||
// base64("user=" {User} "^Aauth=Bearer " {Access Token} "^A^A") | ||
// ^A represents a Control+A (\001) | ||
return base64_encode( | ||
'user=' . $this->username . "\1" . | ||
'auth=Bearer ' . $access_token . "\1\1" | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.