Thanks for creating such an powerful authentication module for java developer under Play framework.
I am recently using the module in my new Rest Application and trying to modify it a little bit for the use of Authenticating for json API.
If I did it correctly, the way of using play-authentication module for json authentication is as follows :
Firstly, we need to override UsernamePasswordAuthProvider.authenticate(), since the private methods in UsernamePasswordAuthProvider getSignup() and getLogin() will only extract the user information in the request as a Form, rather than Json. The override authenticate will call getSignup() and getLogin() methods that can extract user info as json format.
Secondly, we need to provide a enum class Case in our extended class, since the enum class Case is private in the UsernamePasswordAuthProvider class.
Thirdly, we need to implement the handleLogin() and handleSignup() in our extended class, as they are static, cannot be override, and for login and signup, return the handleLogin and handleSignup() method in the extended class.
However, if the getSignup() and getLogin() methods are protected rather than private and can be override, then the override of the UsernamPasswordAuthProvider class would be much easier.
So my question is, why the getSignup() and getLogin() methods are private? Can it be changed into protected? What would be the side effects if changed to protected?
Dear joscha,
Thanks for creating such an powerful authentication module for java developer under Play framework.
I am recently using the module in my new Rest Application and trying to modify it a little bit for the use of Authenticating for json API.
If I did it correctly, the way of using play-authentication module for json authentication is as follows:
Firstly, we need to override UsernamePasswordAuthProvider.authenticate(), since the private methods in UsernamePasswordAuthProvider getSignup() and getLogin() will only extract the user information in the request as a Form, rather than Json. The override authenticate will call getSignup() and getLogin() methods that can extract user info as json format.
Secondly, we need to provide a enum class Case in our extended class, since the enum class Case is private in the UsernamePasswordAuthProvider class.
Thirdly, we need to implement the handleLogin() and handleSignup() in our extended class, as they are static, cannot be override, and for login and signup, return the handleLogin and handleSignup() method in the extended class.
However, if the getSignup() and getLogin() methods are protected rather than private and can be override, then the override of the UsernamPasswordAuthProvider class would be much easier.
So my question is, why the getSignup() and getLogin() methods are private? Can it be changed into protected? What would be the side effects if changed to protected?