Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play Framework 2.4 authorization

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?

like image 505
vlad_ter Avatar asked Mar 11 '26 14:03

vlad_ter


1 Answers

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.

like image 127
Jérémy Buget Avatar answered Mar 14 '26 03:03

Jérémy Buget