Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent new user's registration on JHipster

Tags:

jhipster

I want to create a closed community. So I wold have a lot of users but all of them will be invited by myself or somebody. Moreover I want them to have only one option to login - social accounts.

I've implemented this functionality but for me it looks like set of hack: 1) forbid /api/register endpoint to prevent self registration by the registration form 2) Do not create new user if it is still has not been created (here SocialService#createUserIfNotExist) 3) Modify some email templates

My questions now are: 1) Is it is right way or you can suggest better solution? 2) Do you think that it may be a good option for further JHipster generator?

like image 233
Sergey Babinsky Avatar asked Nov 09 '22 03:11

Sergey Babinsky


1 Answers

The most important thing is first to block the backend calls to the /api/register endpoint by blacklisting it using .denyAll() in the security configuration. This will right away reject any request with HTTP 401 Unauthorized. Secondarily you can work backwards and remove frontend and backend call.

like image 150
dimitrisli Avatar answered Jan 04 '23 01:01

dimitrisli