I have a class (Account) that represents the user's system. Account contains a field role. It is the enum that contains three cases. Account class
public class Account extends Model {
@Id
@Email
public String email;
@Required
@NotNull
public String password;
@Required
@NotNull
public String firstName;
@Required
@NotNull
public String lastName;
@Required
public String phone;
public MyRole role;
MyRole
public enum MyRole {
ADMIN,
TEACHER,
USER
}
How can I implement an authorization?
I think you could use Deadbolt-2 library, listed in the Play Framework plugins.
In the same idea of not reinvent the wheel, did you take a look at the Play-Authenticate plugin ? An another advantage of this last one is that it is compatible with Deadbolt-2.
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