BUSINESS PROBLEM
On VCertTknClient exists two ways to ensure that a new VCertTknClient will have the correct credentials to perform interactions with TPP.
The first one is create an Authentication object setting into it the accessToken and then put it as credentials on the Config object which is passed to the VCertTknClient constructor.
The second option is to create an Authentication object setting into it the user and password, and then after the VCertTknClient is created then call to VCertTknClient.getAccessToken passing the Authentication object as argument.
On VCertClient, no matter the flavor used, it will needed to provide the credentials(apiKey for Cloud and user&password for TPP) in an Authentication object and then pass it to the created VCertClient object calling the authenticate method.
Additional to the evident differences, on VCertTknClient when it's used the first option, the accessToken provided to the Authentication object is not validated resulting that until an operation is performed it will determined if the accessToken is valid or not.
Opposite to that, the calling to the VCertTknClient.getAccessToken returns a TokenInfo which needs to be analized to determine if the credentials are valid and VCertClient.authenticate even is validating the credentials, there is not any result/exception returned to identify if the credentials are valid or not, so until an operation is performed it will determined that situation.
PROPOSED SOLUTION
Homologate the first option on VCertTknClient to VCertClient, that is provide the Authentication object to the Config object avoiding the use of the authenticate method.
Ensure throws an Exception if the credentials are not valid in the VCertTknClient.getAccessToken and VCertClient.authenticate methods.
BUSINESS PROBLEM On
VCertTknClient
exists two ways to ensure that a newVCertTknClient
will have the correct credentials to perform interactions withTPP
. The first one is create anAuthentication
object setting into it theaccessToken
and then put it ascredentials
on theConfig
object which is passed to theVCertTknClient
constructor. The second option is to create anAuthentication
object setting into it theuser
andpassword
, and then after theVCertTknClient
is created then call toVCertTknClient.getAccessToken
passing theAuthentication
object as argument.On
VCertClient
, no matter the flavor used, it will needed to provide the credentials(apiKey for Cloud and user&password for TPP) in anAuthentication
object and then pass it to the createdVCertClient
object calling theauthenticate
method.Additional to the evident differences, on
VCertTknClient
when it's used the first option, theaccessToken
provided to theAuthentication
object is not validated resulting that until an operation is performed it will determined if theaccessToken
is valid or not. Opposite to that, the calling to theVCertTknClient.getAccessToken
returns a TokenInfo which needs to be analized to determine if the credentials are valid andVCertClient.authenticate
even is validating the credentials, there is not any result/exception returned to identify if the credentials are valid or not, so until an operation is performed it will determined that situation.PROPOSED SOLUTION Homologate the first option on
VCertTknClient
toVCertClient
, that is provide theAuthentication
object to theConfig
object avoiding the use of theauthenticate
method.Ensure throws an Exception if the credentials are not valid in the
VCertTknClient.getAccessToken
andVCertClient.authenticate
methods.