Sat, Jan 29, 2022

Using Azure AD authentication for a Go api

So after a long time I thought I’d take another look at Go and whilst struggling to think what little app should I write to get back in the saddle with, the legend that is Christos Matskas mentioned he wanted to try using a Go api against Azure AD for authentication. So I fired up GoLand and got to work writing an API.

Setting up Azure AD

  1. You will need to create an Azure Directory in your account which is pretty straightforward. The only user in the directory will be you.
  2. Inside the directory you will then need to register an application, again pretty straightforward.
  3. Next under Certificates & Secrets, you will need to create a secret, this will be used as part of the auth handshake. Give it a name and Azure will create the value. Take a copy of it ready for your API
  4. On the Overview page take a copy of the Application (client) ID
  5. On the Overview page take a copy of the Directory (tenant) ID
  6. Go to Expose An API
  7. Click Add a scope
  8. Create something like “allow_user” and choose Admins and users
  9. Go to API Permissions and click Add a Permission
  10. Select My APIs and select your application/API
  11. Tick the scope you just created
  12. Now here’s a weird thing, if you don’t see your scope, try going to another tab in your browser or refresh you Azure Portal page. Something is broken IMO in that it takes time or needs refreshing for it to show up
  13. Click Manifest on the left hand side
  14. Change accessTokenAcceptedVersion to 2 and click Save

Tue, Apr 13, 2021

Terminology Glossary

This page will list and describe common words and terms that you might come across as a software developer which you can refer to at a later date knowing there’s a place to go to when someone uses a term that you don’t know, are unsure of or can’t remember

Terms

Cohesion -
Composition Root -
Coupling -
Cross-Cutting -
KPI -
Lift & Shift -
OKR -
Orthogonal -
Projection -
Shift Left -

Fri, Jan 29, 2021

Tracing IO in .NET Core

I was made aware of OpenTelemetry a while ago by a blog series Jimmy Bogard and put it in my favourites to read at a later date. Of course I didn’t really get back to it in depth and gave it a quick scan at the time although it is a well written in depth blog series so I suggest you do check it out. A while later I saw a blog post by Rehan Saeed which gives an introduction on what OpenTelemetry is and how it works and the concepts behind it and is definitely worth a read. At the same time I saw a YouTube video by Elton Stoneman that whilst more aimed at using tracing using Kubernetes he demonstrates a .NET app running and the tracing details appear in Jaeger

Fri, Aug 7, 2020

Understanding type aliases

I recently wrote a single case discriminated union which is what I wanted but was also confused why it didn’t behave like a type alias and then learnt that these two are different things. type CustomerId = int type CustomerId = CustomerId of int I was aware of both syntaxes and from a quick scan they look the same however they behave differently and rightly so. As I travel the F# road there is more emphasis on creating types for your functions.

Fri, Jul 17, 2020

Understanding F# applicatives and custom operators

After discussing something with Ian Russell he suggested I take some time to read through another fine blog post he has written and understand F# applicatives and custom operators. I found myself in familiar territory when reading F# blog posts and it’s something similar to the five stages of grief. Nod, Nod, I understand what’s going on, Umm, WTF is going on. As Ian did in his Intro to F# series he sets out a simple domain problem and goes about how to address it. We want to return a ValidatedUser from a function but if the user fails validation we return a list of validation errors.

The code in the blog post was pretty self explanatory until, it wasn’t, which I have pasted below:

Sun, Jun 28, 2020

Understanding F# map/bind

This blog post aims to explain map/bind in F# in a code only example. It took me a while so I’m writing it up here so I can come back to it and re-read it for the 100th time most likely!

Menu