« first day (3162 days earlier)      last day (1789 days later) » 

11:00 PM
It's a pain, especially at first, I get it
If you're in Azure, setting the AzureAD thing on an app service gets you most of the way there
 
11:12 PM
i feel like there has to be a more simple way then Adding 3 classes to do an OR statement
 
Yeah, I'm with you
Can't you just do [Authorize(Roles = "This,That")]
or am I missing something here
Oh, you're not doing roles
you're doing policies
I don't know if this is relevant to you
his thing seems like a lot of work
 
could be
 
So you have a couple of these IAuthorizationHandler guys, right
and you want to succeed if any of them are true, right
 
right
The way microsoft implements it's AzureAD stuff is a little bit of a mystery too
in StartUp.cs
        services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
            .AddAzureAD(options => Configuration.Bind("AzureAd", options));
        services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
        {
            options.Authority = options.Authority + "/v2.0/";
            options.TokenValidationParameters.ValidateIssuer = false;
        });
        services.AddAuthorization(options =>
        {
            options.AddPolicy("Group1", policy => policy.RequireClaim("groups", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"));
        });
that was the required lines to get AzureAD authenticating against group1
 
Yeah, I can't help you with that
 
11:21 PM
that park works fine
part**
what im getting at, is to throw middleware into that pipeline
scares me
because it's so abstract how they are handling it
or im just an idiot
 
Yeah, I get it
I never quite got that whole thing either
but then, I've never had to
it's a little too much magic for my tastes
so do these handlers you're looking at have to be mixed and matched
 
I always end up giving up and writing If statements in the filter
 
or can you do what they do in this example here and just roll the logic into one handler
 
but then i miss out on all the pre built microsoft stuff
 
Yeah, it's worth figuring out, you get a lot of nice free stuff
but you gotta work at it
 
11:23 PM
what kind of stuff do you write?
 
So could you have something like

public class AnyAuthHandler : IAuthorizationHandler
{

  private IAuthorizationHandler[] _handlers;
  public AnyAuthHandler(params IAuthorizationHandler[] handlers)
  {
      _handlers = handlers;
   }


   public async Task HandleAsync(AuthorizationHandlerContext context)
  {
        var results = await Task.WhenAll(_handlers.Select(x => x.HandleAsync(context)))
        if (results.Any(x => x == True))
           //pass
         else
           //fail

  }
}
I work on an API type thing, too, but the Azure AD stuff was done before I joined the project
so I'm lucky
 
oh nice, are you using .net core?
for the API
 
Yeah. Very futuristic.
 
haha
.net core 3.0 is not released yet right?
I'm really looking forward to Blazor, have you seen it?
 
Nah, I don't get to generate many web pages.
 
11:26 PM
well im sure it will be a flop like silverlight
but if its not, no more javascript would be nice
do you use oData in your API?
 
Nah, it's not complicated enough to need anything fancy like that.
 
I really like oData, was super easy to configure
probably would get slow on a big deployment tho, does all the list filtering in c# rather than sql
 
I am enjoying using EF.
 
I need to make the swap to EF, i still write SQL :/
i basically wrote my own version of entity framework...
 
Ah, reinventing the wheel.
 
11:31 PM
but id rather use microsofts..
i didn't want too!
I'm just bad at reading documentation
i love the creative part of programming, lack the disclipline
 
You're gonna have to get good at some point.
 
trying to with Azure AD and all this stuff
I'm trying to implement that code you gave me, i'll tell you if it works in a few min
 
you're gonna have to tweak it a little, since these IAuthHandlers don't return anything
you might want to just give it some functions instead of full on auth handlers
but anyways, I gotta head out, so follow your dreams
 
thanks for the help, take it easy grace!
 

« first day (3162 days earlier)      last day (1789 days later) »