Custom middleware on dashboard nodes?

The security documentation mentions Custom Middleware. For http-in nodes it works as advertised. However I'd like to use it for dashboard access too.

What do I need to do? From a first view the potential option is to embed NodeRED and use standard Express middleware. Is that feasible or is there a better option?

That is certainly feasible yes.

You could also look at uibuilder's security branch. Though I've been struggling with the time to try and finish it off.