• Brian Boorman (unregistered)

    Plot twist - Paulette really works for TheDailyWTF and this line is in the login code section for this site's comment section. That is why it only works sometimes and people resort to posting as a guest and getting held for moderation.

  • Tim (unregistered)

    maybe both functions have side effects and both need to be called to initialize the authentication providers

  • WTFGuy (unregistered)

    The fact they're passing String.Empty into both is key. Tim's idea has merit, but why structure the calls as an if statement rather than as two discarding method calls?

    Assuming this isn't just pure stupidity or an artifact of some long-lost refactoring or maintenance change ...

    Passing String.Empty into something that does a table lookup on that input has a few sorts of reasonable results. Return a deliberate default, return an accidental default (e.g. first or last in list), return null, or throw an exception.

    My bet is the method returns a default and under some configuration circumstances those defaults are the same. In which case the rest of the code we don't see does ???.

    Another horrid possibility is this is a sort of a version check. In the browser wars we learned to check for actual capabilities, not sniff the browser version and reason from than. Perhaps this dev absorbed that lesson a little too well and is sniffing for something that changed behavior between two long-ago versions.

  • (nodebb) in reply to WTFGuy

    My bet is also on side effects; specifically, I am wondering what the function does when an external provider is not available for some reason, due to networking issues, etc. I'm guessing that it might return an internal provider when the external one is not available and this line basically is an ad hoc "Is the external provider unavailable" check.

  • (nodebb)

    I stopped reading after wrapping authentication because I always don't read stories that start with cleaning a loaded gun.

    Addendum 2023-04-19 10:33: And just right now I saw this popping up for my twitter subscriptions: https://twitter.com/dotnet/status/1648691927515029509

    Irony? Nah. Just Darwin lol

  • Jason Stringify (unregistered)

    the reasoning that lead to this line:

    *led

  • (nodebb) in reply to TheGreatLobachevsky

    My bet is also on side effects; specifically, I am wondering what the function does when an external provider is not available for some reason, due to networking issues, etc. I'm guessing that it might return an internal provider when the external one is not available and this line basically is an ad hoc "Is the external provider unavailable" check.

    That makes a lot of sense. The empty string apparently makes sense to the provider, probably means do nothing. If external authentication is unavailable you get back this same internal one. Since it's actually looking it up in a table it's the same result in both cases. This really is:

    bool IsExternalAuthenticaionUnavailable()

  • markm (unregistered)
    Comment held for moderation.
  • (nodebb)

    I thought it may have been some debugging code, checking that the method was doing what it said it was, and was accidentally left in.

  • mitch (unregistered)
    Comment held for moderation.

Leave a comment on “Providing Authentication”

Log In or post as a guest

Replying to comment #:

« Return to Article