We've already seen the declarative approach, so now let's see the programmatic approach.
Using programmatic security
Getting ready
Let's start by adding the dependency:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
How to do it...
- Let's first define our roles list:
public class Roles {
public static final String ADMIN = "admin";
...