Multiple REST Interfaces on Play! 2 applications

We have a game! where we need to set up the set of REST interfaces for the intranet and the set of REST interfaces that we must provide to the public Internet. They share the data layer, so we would like to combine them, if possible. I believe that they will work on different ports. Being new to Play !, I don’t know if it can be done in one Play! example. I looked at the modules, but that didn't seem to match what we were doing. Has anyone had experience with this kind of scenario?

Forgot to mention that we use Play! 2.

+4
source share
1 answer

You can restrict / allow access to resources by checking ip.

public class IPLocalSecurity extends Controller { @Before public static void checkAccess() throws Exception { if (!request.remoteAddress.matches("192\.168\.1\.*")) { forbidden(); } } } 

and use this in the resource controller.

 @With(IPLocalSecurity.class) public class IntranetController extends Controller{ .... } 
0
source

Source: https://habr.com/ru/post/1434287/


All Articles