sonalake / generator-jhipster-multitenancy

A JHipster blueprint for creating multitenant applications
84 stars 29 forks source link

Tenant entity (Company) adds "UserService" in the @Before Execution Pointcut #101

Open MSSP-BLKing opened 5 years ago

MSSP-BLKing commented 5 years ago

When an OAuth2 user logs in for the first time, their login information is stored in the JHI_USER table, using the syncUserWithIDP method in UserService.

The multitenancy blueprint adds UserService to the Tennant Entity (Company) Aspect class in the beforeExecution method. With this setting, every time the UserService is called it runs userRepository.findOneByLogin, but because sycUserWithIDP hasn't run yet the user is not in the DB throwing a "java.util.NoSuchElementException: No value present" stack trace.

Removing UserService from the pointcut alleviates the issue, but may open a way to see users from other companies

CharlotteFawsitt commented 5 years ago

Thank you for bringing this up. We will look into this issue and if you have any other suggestions for this it would be appreciated.

jduggan83 commented 4 years ago

Hi @BLKingLLC

I have a had a look into this and unfortunately there is no obvious fix. We need to keep this piece ofcode to ensure users with a tenant can't see other tenants. Have you implemented any fix on your project that we could incirporate into the blueprint?