Stream: hapi
Topic: simple authentication with docker
Mareike Przysucha (Mar 09 2022 at 10:46):
Dear community,
I am currently setting up a hapi-server for a feasibility study.
Therefore we want to limit access by setting a simple user login.
Is it possible to set a user name and a password when running a hapi server with docker?
Thanks in advance for your answers.
Patrick Werner (Mar 09 2022 at 11:10):
Not included in the docker image. You could:
- modify JPAstarter and add a BasicAuth Interceptor
- put an apache/nginx reverse proxy in front of hapi and do auth in the apache (no need to modifiy the docker image)
Mareike Przysucha (Mar 09 2022 at 11:18):
Thanks, Patrick, for your reply. I will try and report on my experiances.
Mareike Przysucha (Mar 15 2022 at 13:30):
Hi there. Due to our requirements I think only the first is possible.
Now I am facing the next problem:
I wrote a BasicSecurityInterceptor like proposed here - though changing the verification part - and added the interceptor in BaseJpaRestfulServer with registerInterceptor(new BasicSecurityInterceptor());
. When I then build the docker image and run this image, I get the following BeanDefinitionOverrideException:
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException:
Invalid bean definition with name 'mdmRuleValidator' defined in class path resource
[ca/uhn/fhir/jpa/starter/mdm/MdmConfig.class]:
Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=null;
autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName=mdmConfig; factoryMethodName=mdmRuleValidator; initMethodName=null;
destroyMethodName=(inferred);
defined in class path resource [ca/uhn/fhir/jpa/starter/mdm/MdmConfig.class]]
for bean 'mdmRuleValidator':
There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3;
dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName=ca.uhn.fhir.jpa.mdm.config.MdmCommonConfig;
factoryMethodName=mdmRuleValidator; initMethodName=null; destroyMethodName=(inferred);
defined in class path resource [ca/uhn/fhir/jpa/mdm/config/MdmCommonConfig.class]]
bound.
Does anyone have an idea on how to cope with this problem?
Patrick Werner (Mar 15 2022 at 14:21):
your error points to the mdm part of hapi. Did you change sth. for the MDM Config?
Mareike Przysucha (Mar 15 2022 at 14:36):
not that I were aware of, but I'll check it.
Jens Villadsen (Mar 15 2022 at 14:37):
either enable https://github.com/trifork/hapi-fhir-jpaserver-starter/blob/929a3535fa93d33b24cef06ed4158ae2fcb9f6a2/src/main/resources/application.yaml#L4 or disable https://github.com/trifork/hapi-fhir-jpaserver-starter/blob/929a3535fa93d33b24cef06ed4158ae2fcb9f6a2/src/main/resources/application.yaml#L103
Mareike Przysucha (Mar 15 2022 at 14:45):
@Patrick Werner : I copied the files from jpa-starter => same error. That's not the problem.
@Jens Villadsen: I enabled the first, now there is no more error. Thank you so much.
Last updated: Apr 12 2022 at 19:14 UTC