Sometimes instead of simply rendering a view from your action, I need to redirect the user to another URL, or call another action. In a multi-tenant application I'm working on, I handle all default requests to many domains with a single action in my FubuMVC application. I want to choose which behavior chain to run, depending on the URL that the user has browsed to. In this post I'm going to explain how FubuMVC allows you to perform these actions.
My name is Rex Morgan and I'm a Staff Software Engineer in Austin, TX working at Indeed.
I love learning new languages and tinkering with new technologies. I'm currently having fun with Elixir, Java, C#, and Kubernetes.
A pattern that's regularly used with FubuMVC is the one model in, one model out pattern. This is also known as OMIOMO and, my personal favorite, the thunderdome pattern. It took me a little while to understand why this pattern is in place and seems to be a gotcha when I come back to FubuMVC after an extended period of time. I'm going to write about why I use this pattern, to document it for both others, and my future self.
In this post, I'll be going over how to write a custom authorization rule to keep users from being able to edit another user's blog post in a simple blogging application. I'll do this by plugging into the authorization facilities built into FubuMVC. When it comes to authorization, FubuMVC is very powerful in letting you setup extremely customizable rules for deciding who has access to what. Luckily, Joshua Arnold was able to help me get these rules setup and I'd like to document the process for everyone else.
If you're using FubuMVC and your site requires users to login, you'll probably want to use the built in authentication facilities that FubuMVC provides. In this post, I'll attempt to explain how this works. I'm going to write an authentication convention to block access to certain actions from unauthenticated users.