Decorate existing auth features

When I add the auth features today, I’d like to decorate them for my customers, is this possible?

I tried to dynamically find the Route attribute and then edit its values like this:

     var authRoute = typeof(Authenticate)
     authRoute.Summary = "Authentication methods";
     authRoute.Notes = "This service contains authentication methods using several different providers.";
     authRoute.Verbs = "GET";

But that didn’t work, I just got null for authRoute. Then I tried to add an attribute instead:

      .AddAttributes(new RouteAttribute("/authenticate/logout")
         Summary = "Log out your current user session",
         Notes = "Logs out your current user session and clears cookies",
         Verbs = "GET"

But instead of decorating, I got two routes and I probably broke the mechanisms as well.


The built-in AuthFeature doesn’t use hard-coded [Route] attributes, it instead dynamically Registers Services with IAppHost.RegisterService, i.e:

    foreach (var registerService in ServiceRoutes)
        appHost.RegisterService(registerService.Key, registerService.Value);

You can override RegisterService in your AppHost to modify how the AuthenticateService gets registered, i.e:

public override void RegisterService(Type serviceType, params string[] atRestPaths)
    if (serviceType != typeof(AuthenticateService)) 
        base.RegisterService(serviceType, atRestPaths);

    string verbs = "POST";
    string summary = "...";
    string notes = "...";

    foreach (var atRestPath in atRestPaths)
        if (atRestPath == null) continue;
        this.Routes.Add(typeof(Authenticate), atRestPath, verbs, summary, notes);

This seems to be what I’m looking for, thanks!