-
Notifications
You must be signed in to change notification settings - Fork 10
accessToken / refreshToken only not working with ConnectorType.TPP_TOKEN #123
Description
The following code is failing:
//Create an Authentication object with the access token
final Authentication auth = Authentication.builder()
.accessToken("9PQwQeiTLhcB8/W3/z2Lbw==")
.build();
//Create a Config object setting the Authentication object
final Config config = Config.builder()
.connectorType(ConnectorType.TPP_TOKEN)
.baseUrl("https://tpp.venafi.example")
.credentials(auth)
.build();
//Create the client with the Config object. The client will be authenticated
final VCertTknClient client = new VCertTknClient(config);
Error:
Exception in thread "main" com.venafi.vcert.sdk.VCertException: feign.FeignException$Unauthorized: status 401 reading TppToken#verifyToken(String)
at com.venafi.vcert.sdk.VCertException.fromFeignException(VCertException.java:57)
at com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector.verifyAccessToken(TppTokenConnector.java:98)
at com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector.authorize(TppTokenConnector.java:70)
at com.venafi.vcert.sdk.connectors.Connector.authenticate(Connector.java:78)
at com.venafi.vcert.sdk.VCertClient.(VCertClient.java:40)
at com.venafi.vcert.sdk.VCertTknClient.(VCertTknClient.java:17)
at org.example.VenafiTest.main(VenafiTest.java:35)
Caused by: feign.FeignException$Unauthorized: status 401 reading TppToken#verifyToken(String)
at feign.FeignException.clientErrorStatus(FeignException.java:161)
at feign.FeignException.errorStatus(FeignException.java:141)
at feign.FeignException.errorStatus(FeignException.java:133)
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:92)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:151)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:80)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)
at jdk.proxy2/jdk.proxy2.$Proxy5.verifyToken(Unknown Source)
at com.venafi.vcert.sdk.connectors.tpp.TppTokenConnector.verifyAccessToken(TppTokenConnector.java:96)
... 5 more
When adding usernamen and password to the Authentication object and ONLY when removing accessToken it works.
But this means, we can not persist the refreshtoken and re-use it. We always must revoke it after every "transaction"