Open-EO / openeo-spring-driver

openEO driver build on spring using WCPS and ODC storage access
Apache License 2.0
0 stars 0 forks source link

Feature/basic auth #86

Closed pierocampa closed 1 year ago

pierocampa commented 1 year ago

Added support for Basic Authentication (BA) + Bearer token (JWT-based).

Added

Upgraded

Deprecated

Not supported


The implementation has followed the openeo API v1.1.0.

clausmichele commented 1 year ago

@pierocampa since this includes many changes, I think the best would be to set up the spring-driver in a new Ubuntu 22 VM and test the functionality with some real interactions.

clausmichele commented 1 year ago

@pierocampa some things that need to be fixed before moving on:

  1. The /processes endpoint should be open, no authentication required
  2. Currently. when downloading the result of a batch job, it requires again the authentication, it shouldn't be the case, probably it should use an already available token? (GET request to something like /download/JOB-ID/result.tiff)
clausmichele commented 1 year ago

@pierocampa the code is still trying to connect to the Eurac authentication server despite the basic auth configuration is activated.

Full log: ``` {"@timestamp":"2023-08-28T09:08:41.246Z", "log.level": "INFO", "message":"Starting TestFavicon using Java 11.0.20 on explorer1 with PID 1142938 (started by guest_1 in /home/USERS/guest_1/src/openeo-spring-driver)", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.TestFavicon"} {"@timestamp":"2023-08-28T09:08:41.292Z", "log.level": "INFO", "message":"The following profiles are active: BASIC_AUTH", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.TestFavicon"} {"@timestamp":"2023-08-28T09:08:45.625Z", "log.level": "INFO", "message":"Catalogues harvesting done (3.026 s).", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.CollectionsApiController"} {"@timestamp":"2023-08-28T09:08:45.811Z", "log.level":"DEBUG", "message":"Job Scheduler has been initialized successfully!", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.components.JobScheduler"} {"@timestamp":"2023-08-28T09:08:48.036Z", "log.level":"DEBUG", "message":"JobEventListener successfully added to listenerList!", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.JobsApiController"} {"@timestamp":"2023-08-28T09:09:49.074Z", "log.level":"ERROR", "message":"Application run failed", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.springframework.boot.SpringApplication","error.type":"org.springframework.beans.factory.UnsatisfiedDependencyException","error.message":"Error creating bean with name 'filterChainExceptionHandler': Unsatisfied dependency expressed through field 'resolver'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"","error.stack_trace":[ "org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'filterChainExceptionHandler': Unsatisfied dependency expressed through field 'resolver'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639)", "\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)", "\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)", "\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)", "\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)", "\tat org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)", "\tat org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)", "\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:302)", "\tat org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121)", "\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)", "\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)", "\tat org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)", "\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)", "\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)", "\tat org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43)", "\tat org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248)", "\tat org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$8(ClassBasedTestDescriptor.java:363)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.executeAndMaskThrowable(ClassBasedTestDescriptor.java:368)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeTestInstancePostProcessors$9(ClassBasedTestDescriptor.java:363)", "\tat java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)", "\tat java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)", "\tat java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)", "\tat java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)", "\tat java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)", "\tat java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)", "\tat java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)", "\tat java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)", "\tat java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestInstancePostProcessors(ClassBasedTestDescriptor.java:362)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$instantiateAndPostProcessTestInstance$6(ClassBasedTestDescriptor.java:283)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:282)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:272)", "\tat java.base/java.util.Optional.orElseGet(Optional.java:369)", "\tat org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:271)", "\tat org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)", "\tat org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:102)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:101)", "\tat org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:66)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)", "\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1541)", "\tat org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)", "\tat org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)", "\tat java.base/java.util.ArrayList.forEach(ArrayList.java:1541)", "\tat org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)", "\tat org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)", "\tat org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)", "\tat org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)", "\tat org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)", "\tat org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)", "\tat org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)", "\tat org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)", "\tat org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)", "\tat org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)", "\tat org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)", "\tat org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)", "\tat org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150)", "\tat org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124)", "\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)", "\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)", "\tat org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)", "\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)", "Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:767)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:719)", "\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)", "\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)", "\tat org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)", "\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)", "\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656)", "\t... 87 more", "Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:767)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:719)", "\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)", "\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)", "\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1598)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1562)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1451)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1338)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:759)", "\t... 110 more", "Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"", "\tat org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)", "\tat org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)", "\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)", "\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)", "\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)", "\tat org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1598)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1562)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1451)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1338)", "\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)", "\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:759)", "\t... 127 more", "Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"", "\tat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)", "\tat org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)", "\t... 143 more", "Caused by: java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of \"https://edp-portal.eurac.edu/auth/realms/edp\"", "\tat org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:220)", "\tat org.springframework.security.oauth2.client.registration.ClientRegistrations.fromIssuerLocation(ClientRegistrations.java:144)", "\tat org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible(OAuth2ClientPropertiesRegistrationAdapter.java:83)", "\tat org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistration(OAuth2ClientPropertiesRegistrationAdapter.java:59)", "\tat org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.lambda$getClientRegistrations$0(OAuth2ClientPropertiesRegistrationAdapter.java:53)", "\tat java.base/java.util.HashMap.forEach(HashMap.java:1337)", "\tat org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(OAuth2ClientPropertiesRegistrationAdapter.java:52)", "\tat org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration.clientRegistrationRepository(OAuth2ClientRegistrationRepositoryConfiguration.java:49)", "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)", "\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "\tat java.base/java.lang.reflect.Method.invoke(Method.java:566)", "\tat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)", "\t... 144 more", "Caused by: org.springframework.web.client.HttpServerErrorException$BadGateway: 502 Proxy Error: \"502 Proxy Error

Proxy Error

The proxy server received an invalidresponse from an upstream server.
The proxy server could not handle the request GET /auth/realms/edp/.well-known/openid-configuration.

Reason: Error reading from remote server

\"", "\tat org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:108)", "\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:170)", "\tat org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)", "\tat org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)", "\tat org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:819)", "\tat org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:777)", "\tat org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:670)", "\tat org.springframework.security.oauth2.client.registration.ClientRegistrations.lambda$oidc$0(ClientRegistrations.java:155)", "\tat org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:208)", "\t... 156 more"]} {"@timestamp":"2023-08-28T09:09:49.357Z", "log.level": "INFO", "message":"Starting TestFavicon using Java 11.0.20 on explorer1 with PID 1142938 (started by guest_1 in /home/USERS/guest_1/src/openeo-spring-driver)", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.TestFavicon"} {"@timestamp":"2023-08-28T09:09:49.359Z", "log.level": "INFO", "message":"The following profiles are active: BASIC_AUTH", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.TestFavicon"} {"@timestamp":"2023-08-28T09:09:52.375Z", "log.level": "INFO", "message":"Catalogues harvesting done (2.590 s).", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.CollectionsApiController"} {"@timestamp":"2023-08-28T09:09:52.425Z", "log.level":"DEBUG", "message":"Job Scheduler has been initialized successfully!", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.components.JobScheduler"} {"@timestamp":"2023-08-28T09:09:52.703Z", "log.level":"DEBUG", "message":"JobEventListener successfully added to listenerList!", "ecs.version": "1.2.0","service.name":"openeo","service.node.name":"eurac_op","event.dataset":"openeo","process.thread.name":"main","log.logger":"org.openeo.spring.api.JobsApiController"} ```
pierocampa commented 1 year ago

@pierocampa the code is still trying to connect to the Eurac authentication server despite the basic auth configuration is activated.

Ok, the problem is Spring Boot OAuth2 client autoconfiguration which is triggered even though the security component is disabled. Working on it today

pierocampa commented 1 year ago

@pierocampa some things that need to be fixed before moving on:

  1. The /processes endpoint should be open, no authentication required

-> ef57d34

  1. Currently. when downloading the result of a batch job, it requires again the authentication, it shouldn't be the case, probably it should use an already available token? (GET request to something like /download/JOB-ID/result.tiff)

This hence probably happened on expired authentication token, right?

pierocampa commented 1 year ago

@pierocampa the code is still trying to connect to the Eurac authentication server despite the basic auth configuration is activated.

Ok, the problem is Spring Boot OAuth2 client autoconfiguration which is triggered even though the security component is disabled. Working on it today

Ok, this should be fixed now also: 367aaa1

pierocampa commented 1 year ago

If you don't have time for a countercheck, we can proceed to merge the branch, then in case of further problems we work on bugfixes. Here I ran all tests, they're good.

clausmichele commented 1 year ago

@pierocampa some things that need to be fixed before moving on:

  1. The /processes endpoint should be open, no authentication required

-> ef57d34

  1. Currently. when downloading the result of a batch job, it requires again the authentication, it shouldn't be the case, probably it should use an already available token? (GET request to something like /download/JOB-ID/result.tiff)

This hence probably happened on expired authentication token, right?

Yes, probably it was due to the token! Yes, please proceed with the merge (after fixing the merge conflict), I won't have time until Friday.