ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PHPMailer\PHPMailer\OAuth Class Reference

OAuth - OAuth2 authentication wrapper class. More...

+ Collaboration diagram for PHPMailer\PHPMailer\OAuth:

Public Member Functions

 __construct ($options)
 OAuth constructor. More...
 
 getOauth64 ()
 Generate a base64-encoded OAuth token. More...
 

Protected Member Functions

 getGrant ()
 Get a new RefreshToken. More...
 
 getToken ()
 Get a new AccessToken. More...
 

Protected Attributes

 $provider
 
 $oauthToken
 
 $oauthUserEmail = ''
 
 $oauthClientSecret = ''
 
 $oauthClientId = ''
 
 $oauthRefreshToken = ''
 

Detailed Description

OAuth - OAuth2 authentication wrapper class.

Uses the oauth2-client package from the League of Extraordinary Packages.

See also
http://oauth2-client.thephpleague.com
Author
Marcus Bointon (Synchro/coolbru) phpma.nosp@m.iler.nosp@m.@sync.nosp@m.hrom.nosp@m.edia..nosp@m.co.u.nosp@m.k

Definition at line 35 of file OAuth.php.

Constructor & Destructor Documentation

◆ __construct()

PHPMailer\PHPMailer\OAuth::__construct (   $options)

OAuth constructor.

Parameters
array$optionsAssociative array containing provider, userName, clientSecret, clientId and refreshToken elements

Definition at line 86 of file OAuth.php.

References PHPMailer\PHPMailer\$options.

87  {
88  $this->provider = $options['provider'];
89  $this->oauthUserEmail = $options['userName'];
90  $this->oauthClientSecret = $options['clientSecret'];
91  $this->oauthClientId = $options['clientId'];
92  $this->oauthRefreshToken = $options['refreshToken'];
93  }

Member Function Documentation

◆ getGrant()

PHPMailer\PHPMailer\OAuth::getGrant ( )
protected

Get a new RefreshToken.

Returns
RefreshToken

Definition at line 100 of file OAuth.php.

Referenced by PHPMailer\PHPMailer\OAuth\getToken().

101  {
102  return new RefreshToken();
103  }
+ Here is the caller graph for this function:

◆ getOauth64()

PHPMailer\PHPMailer\OAuth::getOauth64 ( )

Generate a base64-encoded OAuth token.

Returns
string

Definition at line 123 of file OAuth.php.

References PHPMailer\PHPMailer\OAuth\getToken().

124  {
125  // Get a new token if it's not available or has expired
126  if (null === $this->oauthToken || $this->oauthToken->hasExpired()) {
127  $this->oauthToken = $this->getToken();
128  }
129 
130  return base64_encode(
131  'user=' .
132  $this->oauthUserEmail .
133  "\001auth=Bearer " .
134  $this->oauthToken .
135  "\001\001"
136  );
137  }
getToken()
Get a new AccessToken.
Definition: OAuth.php:110
+ Here is the call graph for this function:

◆ getToken()

PHPMailer\PHPMailer\OAuth::getToken ( )
protected

Get a new AccessToken.

Returns
AccessToken

Definition at line 110 of file OAuth.php.

References PHPMailer\PHPMailer\OAuth\getGrant().

Referenced by PHPMailer\PHPMailer\OAuth\getOauth64().

111  {
112  return $this->provider->getAccessToken(
113  $this->getGrant(),
114  ['refresh_token' => $this->oauthRefreshToken]
115  );
116  }
getGrant()
Get a new RefreshToken.
Definition: OAuth.php:100
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $oauthClientId

PHPMailer\PHPMailer\OAuth::$oauthClientId = ''
protected

Definition at line 71 of file OAuth.php.

◆ $oauthClientSecret

PHPMailer\PHPMailer\OAuth::$oauthClientSecret = ''
protected

Definition at line 64 of file OAuth.php.

◆ $oauthRefreshToken

PHPMailer\PHPMailer\OAuth::$oauthRefreshToken = ''
protected

Definition at line 78 of file OAuth.php.

◆ $oauthToken

PHPMailer\PHPMailer\OAuth::$oauthToken
protected

Definition at line 49 of file OAuth.php.

◆ $oauthUserEmail

PHPMailer\PHPMailer\OAuth::$oauthUserEmail = ''
protected

Definition at line 57 of file OAuth.php.

◆ $provider

PHPMailer\PHPMailer\OAuth::$provider
protected

Definition at line 42 of file OAuth.php.


The documentation for this class was generated from the following file: