Open mraible opened 3 years ago
@mraible as for now the Oauth2 does not produce a User entity as upstream JHipster. I guess in your JDL your Blog entity has a relation to the User entity. That's why it fails by default. Add a custom User entity in your JDL and I'm pretty sure it will work :)
IMO, it should match what the main generator does. The Micronaut blueprint has this capability. I ran it through similar tests when its OAuth support was being developed.
I'm not comfortable with generating User domain object when there is no user management and authentication actually managed by the application. (I'm not with the upstream generator too BTW).
In the Blog sample, we need a user mainly to fullfill the Blog ownership relation. I tend to separate the authentication/authorization aspect of the User from it's data segregation function which is domain dependant.
AFAIK, .Net Core or nodejs blueprints aren't implementing it neither.
Since you're the maintainer of this blueprint, the choice is up to you. I thought it was a cool feature when I added it to the main generator because it allows you to create relationships with the User
object, just like you can with JWT authentication. It also works in a microservices architecture.
If you try to create a JWT-based microservice with a relationship to User
, the generation succeeds, but the compilation fails (similar to how it does here). I think it'd be better if the generation fails and warns the user before they try to compile.
If you have entities that need a relationship to the current user, how would you suggest a developer implements it?
The "save the user right after they log in" implementation might not be ideal. A better solution would be to use something like Okta Event Hooks which can call an endpoint to sync a user when they're created. However, I don't think Keycloak has anything like that, and it's not a standard part of OAuth.
FWIW, this does work in the Micronaut blueprint. I haven't tested this JDL with the .NET Core or Node.js blueprint, but I'd be happy to sponsor their implementation.
If I try this now, it results in the following error:
ERROR! An error occured while running jhipster-quarkus:bootstrap-application#configuringTemplateTask
ERROR! ERROR! Cache provider ehcache is not supported
Error: Cache provider ehcache is not supported
Describe the bug
I tried generating an app with the
blog-oauth2.jdl
. It fails to compile.To Reproduce
Unfortunately, this results in a compilation error.