Class TppTokenConnector
- java.lang.Object
-
- com.venafi.vcert.sdk.connectors.tpp.AbstractTppConnector
-
- com.venafi.vcert.sdk.connectors.tpp.TppConnector
-
- com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector
-
- All Implemented Interfaces:
Connector,IPMConnector,ISSHConnector,TokenConnector
public class TppTokenConnector extends TppConnector implements TokenConnector
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.venafi.vcert.sdk.connectors.tpp.AbstractTppConnector
AbstractTppConnector.AuthorizeRequest, AbstractTppConnector.CertificateRenewalRequest, AbstractTppConnector.CertificateRequestsPayload, AbstractTppConnector.CertificateRetrieveRequest, AbstractTppConnector.CertificateRevokeRequest, AbstractTppConnector.NameValuePair<K,V>, AbstractTppConnector.ReadZoneConfigurationRequest, AbstractTppConnector.ReadZoneConfigurationResponse, AbstractTppConnector.SANItem
-
-
Field Summary
-
Fields inherited from class com.venafi.vcert.sdk.connectors.tpp.TppConnector
credentials
-
Fields inherited from class com.venafi.vcert.sdk.connectors.tpp.AbstractTppConnector
FAILED_TO_AUTHENTICATE_MESSAGE, HEADER_VALUE_AUTHORIZATION, LEGACY_DATA_FORMAT, MISSING_ACCESS_TOKEN_MESSAGE, MISSING_CREDENTIALS_MESSAGE, MISSING_REFRESH_TOKEN_MESSAGE, PKCS8_DATA_FORMAT, revocationReasons, tpp, TPP_ATTRIBUTE_MANAGEMENT_TYPE, TPP_ATTRIBUTE_MANUAL_CSR, tppAPI, vendorAndProductName, zone
-
-
Constructor Summary
Constructors Constructor Description TppTokenConnector(Tpp tpp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthorize(Authentication credentials)Performs the authorization actions using the credentials provided.TokenInfogetAccessToken()returns a new access token.TokenInfogetAccessToken(Authentication auth)returns a new access token.TokenInfogetTokenInfo()protected TppAPIgetTppAPI()ConnectorTypegetType()booleanisEmptyCredentials(Authentication credentials)Determines if the given credentials object is empty or not.TokenInforefreshAccessToken(String clientId)this is for refreshing a token.intrevokeAccessToken()-
Methods inherited from class com.venafi.vcert.sdk.connectors.tpp.TppConnector
generateRequest, getCredentials, getPolicy, getVendorAndProductName, importCertificate, ping, prepareRequest, readPolicyConfiguration, readZoneConfiguration, renewCertificate, requestCertificate, requestCertificate, requestSshCertificate, retrieveCertificate, retrieveSshCertificate, retrieveSshConfig, revokeCertificate, setBaseUrl, setPolicy, setVendorAndProductName, setZone
-
Methods inherited from class com.venafi.vcert.sdk.connectors.tpp.AbstractTppConnector
getTPPIdentity, getTPPPolicy, requestTppSshCertificate, resolveTPPContacts, retrieveTppSshCertificate, retrieveTppSshConfig, setPolicy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.venafi.vcert.sdk.connectors.Connector
authenticate, generateRequest, getCredentials, getVendorAndProductName, importCertificate, ping, readZoneConfiguration, renewCertificate, requestCertificate, requestCertificate, retrieveCertificate, revokeCertificate, setBaseUrl, setVendorAndProductName, setZone
-
Methods inherited from interface com.venafi.vcert.sdk.connectors.IPMConnector
getPolicy, readPolicyConfiguration, setPolicy
-
Methods inherited from interface com.venafi.vcert.sdk.connectors.ISSHConnector
requestSshCertificate, retrieveSshCertificate, retrieveSshConfig
-
-
-
-
Constructor Detail
-
TppTokenConnector
public TppTokenConnector(Tpp tpp)
-
-
Method Detail
-
getType
public ConnectorType getType()
- Specified by:
getTypein interfaceConnector- Overrides:
getTypein classTppConnector- Returns:
- ConnectorType the type of connector Cloud or TPP
-
isEmptyCredentials
public boolean isEmptyCredentials(Authentication credentials)
Determines if the given credentials object is empty or not. This method is used byConnector.authenticate(Authentication)method to determine if the credentials were provided in order to after invoke theConnector.authorize(Authentication)method.- Specified by:
isEmptyCredentialsin interfaceConnector- Overrides:
isEmptyCredentialsin classTppConnector- Returns:
-
authorize
public void authorize(Authentication credentials) throws VCertException
Performs the authorization actions using the credentials provided. This method is used byConnector.authenticate(Authentication)method after the credentials were validated as not empty.Note: For this implementation is being invoked the
Tpp.authorize(AuthorizeRequest)to get the authorization details. Also the credentials given replaces the credentials hold by this instance until this moment and additionally theTppConnector.apiKeyandTppConnector.bestBeforeEndattributes are determined.Note: For this implementation is determined if the Authentication.accessToken() was provided. If that is the case then it's invoked the Tpp.verifyToken(String) method to verify if the provided access Token is valid, otherwise then the Tpp.authorizeToken(AuthorizeTokenRequest) is invoked to get the accessToken and refreshToken which will be set to the credentials of this instance. Also the credentials given replaces the credentials hold by this instance until this moment and additionally the
TokenInfoobject is created.- Specified by:
authorizein interfaceConnector- Overrides:
authorizein classTppConnector- Throws:
VCertException- if the call toTpp.authorize(AuthorizeRequest)throws aFeignException.UnauthorizedorFeignException.BadRequest
-
getTokenInfo
public TokenInfo getTokenInfo() throws VCertException
- Specified by:
getTokenInfoin interfaceTokenConnector- Throws:
VCertException
-
getAccessToken
public TokenInfo getAccessToken(Authentication auth) throws VCertException
Description copied from interface:TokenConnectorreturns a new access token.- Specified by:
getAccessTokenin interfaceTokenConnector- Parameters:
auth- authentication info- Returns:
- the new token.
- Throws:
VCertException- throws this exception when authentication info is null.
-
getAccessToken
public TokenInfo getAccessToken() throws VCertException
Description copied from interface:TokenConnectorreturns a new access token. This method uses theAuthenticationobject passed earlier with theConfigobject.- Specified by:
getAccessTokenin interfaceTokenConnector- Returns:
- the new token.
- Throws:
VCertException- throws this exception when authentication info is null.
-
refreshAccessToken
public TokenInfo refreshAccessToken(String clientId) throws VCertException
Description copied from interface:TokenConnectorthis is for refreshing a token.- Specified by:
refreshAccessTokenin interfaceTokenConnector- Parameters:
clientId- the application id.- Returns:
- a complete info about the new access token, refresh token, expires.
- Throws:
VCertException
-
revokeAccessToken
public int revokeAccessToken() throws VCertException- Specified by:
revokeAccessTokenin interfaceTokenConnector- Returns:
- 1 if the access token was revoked and 0 if not.
- Throws:
VCertException
-
getTppAPI
protected TppAPI getTppAPI()
- Overrides:
getTppAPIin classTppConnector
-
-