cloud-sdk-java
cloud-sdk-java copied to clipboard
Destination with Authenticationtype "OAuth2RefreshToken" leads to error when getting destination
Issue Description
Hello,
we noticed that destinations that have theAuthenticationtype OAuth2RefreshToken lead to an error when executing
DestinationAccessor.getDestination(destinationName);
After looking at the stack trace, I found this exception:
java.lang.IllegalArgumentException: Unknown AuthenticationType: OAuth2RefreshToken.
The enum class does not have this type as value.
Of course, I checked to documentation but only found very few information for Javascript but none for Java regarding this type.
Is it intentional, that destinations with this AuthenticationType can not be fetched for Java? My guess would be, that I am missing the refresh token, but since there is nothing in the docu, I dont know how to provide this.
Could you please support me with this?
- Goal: Get Destination with Type OAuth2RefreshToken
Impact / Priority
We are working on a POC to consume data from Datasphere. We would like to start implementing this after everything is clarified.
Affected development phase: Getting Started/ Development
Error Message
Stack Trace
com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to get destination with name 'DatasphereOdata'.,
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.lambda$getDestination$1(DestinationAccessor.java:108),
at io.vavr.control.Try.getOrElseThrow(Try.java:748),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.getDestination(DestinationAccessor.java:101),
at com.sap.grc.automatedprocedures.api.rest.outbound.destinationservice.DefaultDestinationReader.getDestination(DefaultDestinationReader.java:99),
at jdk.internal.reflect.GeneratedMethodAccessor360.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720),
at com.sap.grc.automatedprocedures.api.rest.outbound.destinationservice.DefaultDestinationReader$$SpringCGLIB$$0.getDestination(<generated>),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientFactory.getHttpDestinationProperties(DefaultHttpClientFactory.java:50),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientFactory.getHttpClient(DefaultHttpClientFactory.java:39),
at jdk.internal.reflect.GeneratedMethodAccessor359.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientFactory$$SpringCGLIB$$0.getHttpClient(<generated>),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientRetryExecutor.getHttpClient(DefaultHttpClientRetryExecutor.java:71),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientRetryExecutor.executeAndGetResponse(DefaultHttpClientRetryExecutor.java:62),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientRetryExecutor.executeWithRetry(DefaultHttpClientRetryExecutor.java:46),
at jdk.internal.reflect.GeneratedMethodAccessor358.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:102),
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:335),
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:211),
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:135),
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:161),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultHttpClientRetryExecutor$$SpringCGLIB$$0.executeWithRetry(<generated>),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultRequestExecutor.executeGetRequest(DefaultRequestExecutor.java:29),
at jdk.internal.reflect.GeneratedMethodAccessor357.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.http.DefaultRequestExecutor$$SpringCGLIB$$0.executeGetRequest(<generated>),
at com.sap.grc.automatedprocedures.api.odata.outbound.v2.metadata.reader.DefaultOdataMetadataReader.tryGetRequest(DefaultOdataMetadataReader.java:76),
at com.sap.grc.automatedprocedures.api.odata.outbound.v2.metadata.reader.DefaultOdataMetadataReader.readMetadata(DefaultOdataMetadataReader.java:58),
at jdk.internal.reflect.GeneratedMethodAccessor396.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720),
at com.sap.grc.automatedprocedures.api.odata.outbound.v2.metadata.reader.DefaultOdataMetadataReader$$SpringCGLIB$$0.readMetadata(<generated>),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.metadata.OdataResultMetadataAdapter.readMetadataAndSetOdataVersion(OdataResultMetadataAdapter.java:76),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.metadata.OdataResultMetadataAdapter.readAndEnrichMetadata(OdataResultMetadataAdapter.java:65),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.metadata.OdataResultMetadataAdapter.readAndEnrichMetadata(OdataResultMetadataAdapter.java:56),
at jdk.internal.reflect.GeneratedMethodAccessor395.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:720),
at com.sap.grc.automatedprocedures.api.odata.outbound.common.metadata.OdataResultMetadataAdapter$$SpringCGLIB$$0.readAndEnrichMetadata(<generated>),
at com.sap.grc.automatedprocedures.businesslogic.core.automatedprocedure.metadatarequestor.DefaultAutomatedProcedureMetadataRequester.enrichAndValidateProcedureWithMetadata(DefaultAutomatedProcedureMetadataRequester.java:85),
at com.sap.grc.automatedprocedures.businesslogic.core.automatedprocedure.metadatarequestor.DefaultAutomatedProcedureMetadataRequester.hasReadMetadataAndUpdateProcedure(DefaultAutomatedProcedureMetadataRequester.java:112),
at com.sap.grc.automatedprocedures.businesslogic.core.automatedprocedure.metadatarequestor.DefaultAutomatedProcedureMetadataRequester.requestAndSaveMetadataInternal(DefaultAutomatedProcedureMetadataRequester.java:102),
at com.sap.grc.automatedprocedures.businesslogic.core.automatedprocedure.metadatarequestor.DefaultAutomatedProcedureMetadataRequester.requestAndSaveMetadataAsync(DefaultAutomatedProcedureMetadataRequester.java:71),
at jdk.internal.reflect.GeneratedMethodAccessor393.invoke(Unknown Source),
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source),
at java.base/java.lang.reflect.Method.invoke(Unknown Source),
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354),
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:64),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123),
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392),
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97),
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184),
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:768),
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:113),
at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.call(ThreadContextExecutor.java:297),
at com.sap.cloud.sdk.cloudplatform.thread.ThreadContextExecutor.execute(ThreadContextExecutor.java:240),
at com.sap.cloud.sdk.cloudplatform.thread.DefaultThreadContextExecutorService.lambda$decorate$0(DefaultThreadContextExecutorService.java:72),
at com.sap.cds.integration.cloudsdk.decorator.CdsThreadContextDecorator.lambda$decorateCallable$0(CdsThreadContextDecorator.java:31),
at com.sap.cds.services.impl.runtime.RequestContextRunnerImpl.run(RequestContextRunnerImpl.java:275),
at com.sap.cds.integration.cloudsdk.decorator.CdsThreadContextDecorator.lambda$decorateCallable$1(CdsThreadContextDecorator.java:29),
at com.sap.grc.automatedprocedures.configuration.asynchronouslythreads.RequestContextExecutorConfiguration$Decorator.lambda$decorateCallable$0(RequestContextExecutorConfiguration.java:94),
at java.base/java.util.concurrent.FutureTask.run(Unknown Source),
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source),
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source),
at java.base/java.lang.Thread.run(Unknown Source), Caused by: java.lang.IllegalArgumentException: Unknown AuthenticationType: OAuth2RefreshToken.,
at com.sap.cloud.sdk.cloudplatform.connectivity.AuthenticationType.ofIdentifier(AuthenticationType.java:118),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationPropertyKey.lambda$createProperty$0(DestinationPropertyKey.java:77),
at io.vavr.control.Option.map(Option.java:392),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationPropertyKey.get(DestinationPropertyKey.java:47),
at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultDestination$Builder.get(DefaultDestination.java:161),
at com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination$Builder.get(DefaultHttpDestination.java:595),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceFactory.handleHttpDestination(DestinationServiceFactory.java:112),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationServiceFactory.fromDestinationServiceV1Response(DestinationServiceFactory.java:66),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationService.loadAndParseDestination(DestinationService.java:146),
at com.sap.cloud.sdk.cloudplatform.connectivity.GetOrComputeSingleDestinationCommand.lambda$prepareCommand$0(GetOrComputeSingleDestinationCommand.java:70),
at io.vavr.control.Try.of(Try.java:75),
at io.vavr.control.Try.ofSupplier(Try.java:92),
at com.sap.cloud.sdk.cloudplatform.connectivity.GetOrComputeSingleDestinationCommand.execute(GetOrComputeSingleDestinationCommand.java:155),
at io.vavr.control.Try.flatMapTry(Try.java:490),
at io.vavr.control.Try.flatMap(Try.java:472),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationService$Cache.getOrComputeDestination(DestinationService.java:851),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationService.tryGetDestination(DestinationService.java:129),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationLoaderChain.tryGetDestination(DestinationLoaderChain.java:89),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationLoader.tryGetDestination(DestinationLoader.java:37),
at com.sap.cloud.sdk.cloudplatform.connectivity.DestinationAccessor.tryGetDestination(DestinationAccessor.java:124),
Dependency Tree
[INFO] +- com.sap.cloud.sdk.cloudplatform:connectivity-oauth:jar:5.8.0:compile
[INFO] | +- com.sap.cloud.sdk.cloudplatform:connectivity-apache-httpclient4:jar:5.8.0:compile
[INFO] | +- com.sap.cloud.environment.servicebinding.api:java-consumption-api:jar:0.10.4:compile
[INFO] | +- com.sap.cloud.security.xsuaa:token-client:jar:3.4.0:compile
[INFO] | | \- org.json:json:jar:20231013:compile
[INFO] | +- com.sap.cloud.security:java-api:jar:3.4.0:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
[INFO] | \- com.sap.cloud.security:java-security:jar:3.4.0:compile
[INFO] | \- com.sap.cloud.security:env:jar:3.4.0:compile
[INFO] | \- com.sap.cloud.environment.servicebinding:java-sap-service-operator:jar:0.10.4:compile
Project Details
- SDK Version: 5.8.0
- Link to GitHub repo: Github Enterprise (github.wdf.sap.corp)
- Project type, for example:
- Spring java app with CAP
- Platform:
- [X] Cloud Foundry
- [ ] Deploy with Confidence (Cloud Foundry)
- [ ] None of the above:
Checklist
- [X] Checked out the documentation and Stack Overflow
- [X] Description provided with all relevant information
- [X] Exception and stack trace provided
- [ ] Attached debug logs
- [X] Attached dependency tree
- [X] Provided Cloud SDK version & link to relevant source code