Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Attributes
Oauth Class Reference

Public Member Functions

 __construct (\Magento\Framework\Math\Random $mathRandom)
 
 generateRandomString ($length)
 
 generateToken ()
 
 generateTokenSecret ()
 
 generateVerifier ()
 
 generateConsumerKey ()
 
 generateConsumerSecret ()
 

Data Fields

const LENGTH_TOKEN = 32
 
const LENGTH_TOKEN_SECRET = 32
 
const LENGTH_TOKEN_VERIFIER = 32
 
const LENGTH_CONSUMER_KEY = 32
 
const LENGTH_CONSUMER_SECRET = 32
 
const LENGTH_NONCE = 32
 
const CALLBACK_ESTABLISHED = 'oob'
 

Protected Attributes

 $_mathRandom
 

Detailed Description

Definition at line 8 of file Oauth.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\Math\Random  $mathRandom)
Parameters
\Magento\Framework\Math\Random$mathRandom

Definition at line 52 of file Oauth.php.

53  {
54  $this->_mathRandom = $mathRandom;
55  }

Member Function Documentation

◆ generateConsumerKey()

generateConsumerKey ( )

Generate random string for consumer key

Returns
string

Definition at line 106 of file Oauth.php.

107  {
108  return $this->generateRandomString(self::LENGTH_CONSUMER_KEY);
109  }

◆ generateConsumerSecret()

generateConsumerSecret ( )

Generate random string for consumer secret

Returns
string

Definition at line 116 of file Oauth.php.

117  {
118  return $this->generateRandomString(self::LENGTH_CONSUMER_SECRET);
119  }

◆ generateRandomString()

generateRandomString (   $length)

Generate random string for token or secret or verifier

Parameters
int$lengthString length
Returns
string

Definition at line 63 of file Oauth.php.

64  {
65  return $this->_mathRandom->getRandomString(
66  $length,
67  \Magento\Framework\Math\Random::CHARS_DIGITS . \Magento\Framework\Math\Random::CHARS_LOWERS
68  );
69  }

◆ generateToken()

generateToken ( )

Generate random string for token

Returns
string

Definition at line 76 of file Oauth.php.

77  {
78  return $this->generateRandomString(self::LENGTH_TOKEN);
79  }

◆ generateTokenSecret()

generateTokenSecret ( )

Generate random string for token secret

Returns
string

Definition at line 86 of file Oauth.php.

87  {
88  return $this->generateRandomString(self::LENGTH_TOKEN_SECRET);
89  }

◆ generateVerifier()

generateVerifier ( )

Generate random string for verifier

Returns
string

Definition at line 96 of file Oauth.php.

97  {
98  return $this->generateRandomString(self::LENGTH_TOKEN_VERIFIER);
99  }

Field Documentation

◆ $_mathRandom

$_mathRandom
protected

Definition at line 47 of file Oauth.php.

◆ CALLBACK_ESTABLISHED

const CALLBACK_ESTABLISHED = 'oob'

Value of callback URL when it is established or if the client is unable to receive callbacks

Requirement in RFC-5849

Definition at line 42 of file Oauth.php.

◆ LENGTH_CONSUMER_KEY

const LENGTH_CONSUMER_KEY = 32

#- #+ Lengths of consumer fields

Definition at line 26 of file Oauth.php.

◆ LENGTH_CONSUMER_SECRET

const LENGTH_CONSUMER_SECRET = 32

Definition at line 28 of file Oauth.php.

◆ LENGTH_NONCE

const LENGTH_NONCE = 32

#- Nonce length

Definition at line 35 of file Oauth.php.

◆ LENGTH_TOKEN

const LENGTH_TOKEN = 32

#+ Lengths of token fields

Definition at line 14 of file Oauth.php.

◆ LENGTH_TOKEN_SECRET

const LENGTH_TOKEN_SECRET = 32

Definition at line 16 of file Oauth.php.

◆ LENGTH_TOKEN_VERIFIER

const LENGTH_TOKEN_VERIFIER = 32

Definition at line 18 of file Oauth.php.


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