JHipster-Registry Swagger UI for microservice says invalid_token with UAA - jhipster

I setup the following components using Jhipster (version of generator-jhipster: # 5.3.1)
Gateway
Jhipster Registry
UAA Server
Everything works fine so far.
In Jhipster Registry, when I go to Administration >> API It opens up Swagger UI. Swagger UI lists the apis for Jhipster-Registry only. But it gives error when the uaa or gateway is selected in the drop down. Swagger UI From Gateway (Administration >> API) works fine. Only from registry it does not work.
Please let me know if I am missing some configuration.

UAA support for the registry was just recently added and will be in the next release. If you want to have it early, you can make the following changes:
In your UAA app's UaaConfiguration.java, add .authorities("ROLE_ADMIN") here.
Then you can use the develop tag for the jhipster-registry Docker image, and add the uaa profile to that container's SPRING_ACTIVE_PROFILES
If you prefer to run the JHipster Registry from source, you can clone the jhipster-registry repository and check out the develop branch

Related

Jhipster microservice without registry does not show swagger

I have created jhipster microservice app without any registry or gateway as I will be using aws managed gateway.
But I don't see the swagger ui.

JHipster-Registry Swagger UI for microservice says invalid_token

I setup the following components using Jhipster (version of generator-jhipster: # 5.0.1)
Gateway
Microservice1
Jhipster Registry
Keycloak as auth server
Everything works fine so far.
In Jhipster Registry, when I go to Administration >> API
It opens up Swagger UI. Swagger UI lists the apis for Jhipster-Registry and gateway. But it gives error when the microservice is selected in the drop down. Swagger UI From Gateway (Administration >> API) works fine. Only from registry it does not work.
Please let me know if I am missing some configuration.
When using the JHipster Registry to manage an OAuth2 microservice architecture, you need to enable the oauth2 profile when running the JHipster Registry. You will then use Keycloak to log in to the registry and manage the services.

jhipster-registry and keycloak : cors error getting service informations

I have a problem with jhispter-registry using keycloak (or okta) for authentication. My microservices stack is mde of registry in version 4.0.1 (but I hab same problem with version 3.3.0), a gateway and a microservice generated by jhipster version 5.3.0. I use keycloak version 4.3.0 in docker.
I manage to authenticate me on registry and gateway without problems.
When I call web service required authentication through gateway (by example http://127.0.0.1:8080/ws/auth), it's ok.
But on registry with administration menu, when I want look gateway configuration (or metrics, logs, ...), I got a cors error after 2 redirections :
from registry to gateway_ip/login: ok
from gateway to keyclok: cors error
And if I want configuration of my service, I got directly an error 401.
All services (registry (version 4.0.1), gateway (generated by jhipster 5.3.0), microservices (generated by version 5.3.0) and keycloak (version 4.3.0 in docker) run in my PC. In /etc/hosts, I added ip 127.0.0.1 to keycloak. I use default configuration for all services, in dev profile.
Is it a bug of jhipster, or have I misconfigured my services ?
Thanks, Denis

How to change route of jhipster microservice

I developed a microservice application with these :
Jhipster registry
Uaa
Gateway
Microservice1
I want to deploy this in production on different server, but I don't want to use IP to access to microservices.
How can I launch microservice1 and uaa to say to the registry that they need to be called with these URLs :
uaa.myapp.com
microservice1.myapp.com

Where is the #AuthorizedFeignClient in Jhipster Release 3.11.0?

I have setup my Jhipster Uaa server, gateways and others micro services and i want to use #AuthorizedFeignClient annotation for inter-service-communication as well explained here : https://jhipster.github.io/using-uaa/
But i cannot find it into the java source generated(Jhispter Release 3.11.0).
Did i have to copy manually in my project this only 2 classes found in jhispter github generator for the moment ? (because still in beta ?) :
.../client/_AuthorizedFeignClient.java
and
.../client/_OAuth2InterceptedFeignConfiguration.java
Thanks,
Francois
currently the #AuthorizedFeignClient annotation is only available for microservice applications using UAA as authentication type, but not for gateways and UAA server itself!
I guess you were looking for the annoation in the gateway, or the the UAA server.
Why is this like this? For the gateway it is because the gateway already has a couple of responsibilities, so building composite logic in there is not a good idea.
If you generate a microservice (not gateway, not uaa server), you should have the client package in your Java root with this annoatation, as well as some more configurations (feign client config, load balanced resource details...)
You can copy those to your gateway, to make it working there.
You can copy them to the UAA, too. More on that, this even will work, but with some weird fact...when UAA will ask service "foo" for some data, it will first ask the UAA for a client credentials authentication....like performing a query to itself...while it could just access grant it itself. There is no accurate way to do it, but I didn't want to keep it in this uncool way in JHipster, so the annotation is for microservice only.

Resources