i18n-routing-bundle and FOSUserBundle

Ran into some problems when configuring the security.yml after a while this is what worked for me (did not realise that you cold use the routes without specifying the language first).

jms_security_extra:
    secure_all_services: false
    expressions: true

security:
    providers:
        fos_userbundle:
            id: fos_user.user_manager

    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    firewalls:
        main:
            pattern: /
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
                check_path:  fos_user_security_check
                login_path:  fos_user_security_login
            logout:       
                path:     fos_user_security_logout
            anonymous:    true

    access_control:
        - { path: ^/\w\w/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/\w\w/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/\w\w/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/\w\w/backend/admin/, role: ROLE_ADMIN }
        - { path: ^/\w\w/backend/, role: ROLE_USER }

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

Hopefully it helps someone 🙂

If I have done something wrong please leave a comment below.

ASP.Net MVC3 Routing with Guid

Spent a couple of hours trying to get routing with a Guid to work for MVC3 without luck. Here is the solution:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute("FooRouteName",
        "Controller/Action/{guidParam}",
         new { controller = "PremiumManager", action = "ActionViewImage" },
         new { guidParam = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$" }
    );
    routes.MapRoute(
         "Default", // Route name
         "{controller}/{action}/{id}", // URL with parameters
         new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
    );
}

A big thanks to tobias @#asp.net irc.freenode.net!