Annotate presenters with @BrixRoute and wrap them in @BrixComponent. Generated routing providers register the presenter with Domino History so pushing a token activates the presenter.
@BrixPresenter
public class AdminPresenter extends Presenter<AdminView> {
@Override
public Set<String> getRoles() {
return Set.of("admin");
}
@Override
public Authorizer getAuthorizer() {
return RolesAllowedAuthorizer.INSTANCE;
}
}
Use :param placeholders in the route path. Brix and Domino History parse path, query, and fragment parts and map them to annotated fields.
SecurityContext sc = (SecurityContext) Brix.get().getCoreComponent().core().getSecurityContext();
sc.setUser(new MyUser());
sc.setUnauthorizedAccessHandler(() -> window.alert("Access denied"));
Annotated fields are refreshed before activation and on token changes. You can also read directly from the routing state for richer access or override setState to map into custom fields.
public class DepartmentAuthorizer implements Authorizer {
@Override
public boolean isAuthorized(IsSecurityContext context, HasRoles hasRoles) {
return context.isAuthenticated()
&& context.getUser().getAttributes().get("department").ifTypeIs(String.class, dept -> {
return dept.equals("engineering");
});
}
}
# use fragment-based filters; others use path filters.Brix.get().router().pushToken(...) to navigate programmatically.CanConfirmNavigation/ProvidesConfirmNavigation register a history interceptor during activation.