pulsar-client-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
pulsar::AuthOauth2 Class Reference

#include <Authentication.h>

Inheritance diagram for pulsar::AuthOauth2:
pulsar::Authentication

Public Member Functions

 AuthOauth2 (ParamMap &params)
 
const std::string getAuthMethodName () const
 
Result getAuthData (AuthenticationDataPtr &authDataOauth2)
 

Static Public Member Functions

static AuthenticationPtr create (ParamMap &params)
 
static AuthenticationPtr create (const std::string &authParamsString)
 
- Static Public Member Functions inherited from pulsar::Authentication
static ParamMap parseDefaultFormatAuthParams (const std::string &authParamsString)
 

Additional Inherited Members

- Protected Attributes inherited from pulsar::Authentication
AuthenticationDataPtr authData_
 

Detailed Description

Oauth2 based implementation of Pulsar client authentication. Passed in parameter would be like:

"type": "client_credentials",
"issuer_url": "https://accounts.google.com",
"client_id": "d9ZyX97q1ef8Cr81WHVC4hFQ64vSlDK3",
"client_secret": "on1uJ...k6F6R",
"audience": "https://broker.example.com"

If passed in as std::string, it should be in Json format.

Member Function Documentation

◆ create() [1/2]

static AuthenticationPtr pulsar::AuthOauth2::create ( const std::string &  authParamsString)
static

Create an AuthOauth2 with an authentication parameter string

See also
Authentication::parseDefaultFormatAuthParams

◆ create() [2/2]

static AuthenticationPtr pulsar::AuthOauth2::create ( ParamMap &  params)
static

Create an AuthOauth2 with a ParamMap

The required parameter keys are “issuer_url”, “private_key”, and “audience”

Parameters
parametersthe key-value to create OAuth 2.0 client credentials
See also
http://pulsar.apache.org/docs/en/security-oauth2/#client-credentials

◆ getAuthData()

Result pulsar::AuthOauth2::getAuthData ( AuthenticationDataPtr &  authDataOauth2)
virtual

Get AuthenticationData from the current instance

Parameters
[out]authDataOauth2the shared pointer of AuthenticationData. The content of AuthenticationData is changed to the internal data of the current instance.
Returns
ResultOk or ResultAuthenticationError if authentication failed

Reimplemented from pulsar::Authentication.

◆ getAuthMethodName()

const std::string pulsar::AuthOauth2::getAuthMethodName ( ) const
virtual
Returns
“token”

Implements pulsar::Authentication.


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