Virtru SDK for C++  2.8.0
Virtru C++ SDK library - Create, Read, and Manage TDF3 Files
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
virtru::CredentialsOidc Class Reference

#include <virtru_credentials_oidc.h>

Inheritance diagram for virtru::CredentialsOidc:
virtru::Credentials

Public Member Functions

 CredentialsOidc (const std::string &owner, const std::string &clientId, const std::string &clientSecret, const std::string &clientPubkey, const std::string &organizationName, const std::string &oidcEndpoint)
 
 CredentialsOidc (const std::string &owner, const std::string &refreshToken, const std::string &clientPubkey, const std::string &organizationName, const std::string &oidcEndpoint)
 
 CredentialsOidc (const std::string &userId, const OIDCHeaders &headers)
 
 CredentialsOidc (const std::string &userId, const std::string &authorizationString, const std::string &clientToken)
 
virtual std::unique_ptr
< Credentials
clone () const
 
virtual ~CredentialsOidc ()
 
virtual OIDCHeaders generateAuthHeaders (const std::string &url, const std::string &method, const std::string &body, const std::map< std::string, std::string > &headers, const std::string &date)
 
virtual std::string getUserId () const
 
virtual std::string str () const
 
void setHTTPServiceProvider (std::weak_ptr< INetwork > httpServiceProvider)
 
std::string getAccessToken ()
 
CredentialsType getType () const
 
std::string getTypeStr () const
 

Protected Member Functions

std::map< std::string,
std::string > 
parseUrlTODO (const std::string &url) const
 

Protected Attributes

CredentialsType m_type
 

Private Member Functions

std::tuple< std::string,
std::string > 
exchangeCredentials (const std::string &clientId, const std::string &clientSecret) const
 
std::tuple< std::string,
std::string > 
exchangeRefresh (const std::string &refreshToken) const
 
std::tuple< std::string,
std::string > 
userInfo (const std::string &accessToken) const
 
std::shared_ptr< INetworkgetHTTPServiceProvider () const
 

Private Attributes

std::weak_ptr< INetworkm_networkServiceProvider
 
std::string m_clientId
 
std::string m_clientSecret
 
std::string m_clientPubkey
 
std::string m_orgName
 
std::string m_oidcEndpoint
 
std::string m_owner
 
OIDCHeaders m_headers
 
std::tuple< std::string,
std::string > 
m_tokens
 

Constructor & Destructor Documentation

virtru::CredentialsOidc::CredentialsOidc ( const std::string &  owner,
const std::string &  clientId,
const std::string &  clientSecret,
const std::string &  clientPubkey,
const std::string &  organizationName,
const std::string &  oidcEndpoint 
)

Constructor

Parameters
owner- Ignored, redundant, kept for backward compatibility
clientId- The OIDC clientcredential client id
clientSecret- The OIDC clientcredential client secret
clientPubKey- The client public key, which will be forwarded to the IdP
organizationName- The org/realm mapped to this client in the IdP
oidcEndpoint- The OIDC IdP endpoint to request tokens from
virtru::CredentialsOidc::CredentialsOidc ( const std::string &  owner,
const std::string &  refreshToken,
const std::string &  clientPubkey,
const std::string &  organizationName,
const std::string &  oidcEndpoint 
)

Constructor

Parameters
owner- Ignored, redundant, kept for backward compatibility
refreshToken- A valid OIDC refresh token as previously issued by 'oidcEndpoint' - this will be exchanged for an access token with updated Virtru claims
clientPubKey- The client public key, which will be forwarded to the IdP
organizationName- The org/realm mapped to this client in the IdP
oidcEndpoint- The OIDC IdP endpoint to request tokens from
virtru::CredentialsOidc::CredentialsOidc ( const std::string &  userId,
const OIDCHeaders headers 
)

Constructor

Parameters
userId- The user id.
header- The headers that are used when communicating with the auth server
virtru::CredentialsOidc::CredentialsOidc ( const std::string &  userId,
const std::string &  authorizationString,
const std::string &  clientToken 
)

Constructor

Parameters
userId- The userId associated with the token
authorizationString- The auth string to be used
clientToken- A valid OIDC token as previously issued
virtual virtru::CredentialsOidc::~CredentialsOidc ( )
virtual

Destructor.

Member Function Documentation

virtual std::unique_ptr<Credentials> virtru::CredentialsOidc::clone ( ) const
virtual

Create a new instance of this object

Returns
- The new instance

Reimplemented from virtru::Credentials.

std::tuple<std::string, std::string> virtru::CredentialsOidc::exchangeCredentials ( const std::string &  clientId,
const std::string &  clientSecret 
) const
private
std::tuple<std::string, std::string> virtru::CredentialsOidc::exchangeRefresh ( const std::string &  refreshToken) const
private
virtual OIDCHeaders virtru::CredentialsOidc::generateAuthHeaders ( const std::string &  url,
const std::string &  method,
const std::string &  body,
const std::map< std::string, std::string > &  headers,
const std::string &  date 
)
virtual

Create the header key/value pairs that should be added to the request to establish authorization

Parameters
url- The full url for the request, including protocol prefix and parameter information
method- The method for the request, such as 'get' or 'post'
body- The body for the request, can be an empty string if there is no body content
headers- a set of http header key/value pairs that should be included in calculations
date- the date string that should be used in calculations
Returns
- map of key/value http header pairs

Reimplemented from virtru::Credentials.

std::string virtru::CredentialsOidc::getAccessToken ( )

Get the access token associated with these credentials

Returns
- The access token as a string
std::shared_ptr<INetwork> virtru::CredentialsOidc::getHTTPServiceProvider ( ) const
private
CredentialsType virtru::Credentials::getType ( ) const
inherited

Get the type of this credentials object, as specified by the CredentialsType enum value

Returns
- The type enum value of this credentials instance
std::string virtru::Credentials::getTypeStr ( ) const
inherited

Get the type of this credentials object, as a string representation of the CredentialsType

Returns
- The type of this credentials instance as a string
virtual std::string virtru::CredentialsOidc::getUserId ( ) const
virtual

Get the userId associated with these credentials.

Reimplemented from virtru::Credentials.

std::map<std::string, std::string> virtru::Credentials::parseUrlTODO ( const std::string &  url) const
protectedinherited
void virtru::CredentialsOidc::setHTTPServiceProvider ( std::weak_ptr< INetwork httpServiceProvider)
virtual std::string virtru::CredentialsOidc::str ( ) const
virtual

Get a debug-friendly string describing this credentials object

Returns
- The type of this credentials instance as a string

Reimplemented from virtru::Credentials.

std::tuple<std::string, std::string> virtru::CredentialsOidc::userInfo ( const std::string &  accessToken) const
private

Member Data Documentation

std::string virtru::CredentialsOidc::m_clientId
private
std::string virtru::CredentialsOidc::m_clientPubkey
private
std::string virtru::CredentialsOidc::m_clientSecret
private
OIDCHeaders virtru::CredentialsOidc::m_headers
private
std::weak_ptr<INetwork> virtru::CredentialsOidc::m_networkServiceProvider
private
std::string virtru::CredentialsOidc::m_oidcEndpoint
private
std::string virtru::CredentialsOidc::m_orgName
private
std::string virtru::CredentialsOidc::m_owner
private
std::tuple<std::string, std::string> virtru::CredentialsOidc::m_tokens
private
CredentialsType virtru::Credentials::m_type
protectedinherited

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