Tag: dotnet

  • Custom Polyglot Notebook Kernel

    Polyglot Notebooks are a great Visual Studio Code extension that allows you to create interactive Notebooks using multiple languages.

    Additional language support, extra commands, formatters, etc. can be added using Dotnet Nuget packages.

    For this article, we will be creating a custom kernel that will execute basic calculator commands with variable support.

    [Read More]
  • OpenID Connect - Dotnet Desktop Application

    Recently, I’ve been deep diving into JSON Web Tokens (JWT) and the OpenID Connect protocols. My end goal was to be able to use the OpenID Connect Authorization Flow to add authentication and authorization to a native desktop application using Dotnet.

    The basic authentication workflow for a native/desktop/console/ application is as follows (RFC 8252 Section 4.1):

    1. Application retrieves the following from the Authorization Server’s OpenID Connection Configuration Endpoint:
      • Signing Keys
      • Authorization Endpoint
      • Token Endpoint
    2. Application opens the system default browser to the Authorization Endpoint URI including the following details as query string parameters:
      • Response Type = “code”
      • Client ID
      • Redirect URI
      • Scope (Must include at least openid)
      • State (Secure random value)
      • Code Challenge
      • Code Challenge Method
    3. Authorization Server’s Authorization Endpoint receives the authorization request and then authenticates and authorizes the user.
    4. Authorization server issues an authorization code and redirects the browser to the specified Redirect URI with the response appended to it as query string parameters.
    5. Application receives the Redirect URI and retrieves the authentication code and validates the state from the response.
    6. Application sends the authentication code to the Token Endpoint including the following details:
      • Grant Type = “authorization_code”
      • Client ID
      • Authentication Code
      • Redirect URI
      • Code Verifier
    7. Authorization server validates the authorization code and issues the ID and Access Tokens.
    8. Application validates the ID Token using the Signing Keys obtained previously.

    There is a lot to unpack in each of these steps but we will cover everything as we implement them.

    [Read More]
  • ShortDash: Cross-platform Shortcut Dashboard

    A few months ago, I was sitting in a video conference and noticed that the room was getting hot. I have a fan but it was just out of reach and it would have been rude to walk out of the frame in the middle of the meeting. At that point I wished I had one of those digital power plugs that you can control from your phone. I did eventually get one of those plugs but you had to use their dedicated app to control it. I thought it would be much more convenient to have a central dashboard where I could control it. And then it would be nice to be able to execute other things. This led to some tinkering with https://ifttt.com/ and its web request functionality. Soon after, the idea of ShortDash began to form.

    ShortDash Dashboard

    ShortDash is a cross-platform shortcut dashboard for your local network. It allows you to create customizable dashboards of shortcuts and actions. You can even turn an old tablet or cell phone into your own personal shortcut dashboard.

    [Read More]