I try to make a website with play with a member and a non member area. So i have controllers with member and non-member methods. But i can only make the whole controller secure [@With(Secure.class)]. Is it possibly to make only a few methods secure and access the others without a login?
Thanks
Yes, you can, although it will require some tweaking on the Secure class. If you check @Secure it has a method annotated with @Before. As per documentation you can indicate which methods the @Before is applied to and for which ones it is skipped.
@Before(unless="login")
So it would be a matter of not running @Before on the public methods. Be aware it may not work properly using @With and you may need to create your own @Before in the controller that manages the security (calling the proper methods in secure).
But it would be simpler to just have 2 controllers, one for secure users and one for public methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With