You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Create an app specific enum that implements Role
importio.avaje.jex.Role;
/** * Create an App specific enum that implements Role. */publicenumAppRolesimplementsRole {
ADMIN,
USER
}
2. Create an Roles enum that uses the app specific enum (for use with avaje-http controllers)
importjava.lang.annotation.Retention;
importjava.lang.annotation.Target;
importstaticjava.lang.annotation.ElementType.METHOD;
importstaticjava.lang.annotation.ElementType.TYPE;
importstaticjava.lang.annotation.RetentionPolicy.RUNTIME;
/** * Create an app specific Role annotation that uses the * app specific role enum. */@Target(value={METHOD, TYPE})
@Retention(value=RUNTIME)
public @interface Roles {
/** * Specify the permitted roles (using app specific enum). */AppRoles[] value() default {};
}
3. Use the Role enum on endpoints that we want the user roles check
1. Create an app specific enum that implements Role
2. Create an Roles enum that uses the app specific enum (for use with avaje-http controllers)
3. Use the Role enum on endpoints that we want the user roles check
4. Implement and register the AccessManager
The text was updated successfully, but these errors were encountered: