Tuesday, December 1, 2026

Building your own OIDC provider: what the server side actually teaches you

Nobody needs to build their own identity provider. Keycloak, Auth0, Entra ID — the mature options are right there. I built one anyway, and it's the most instructive side project I've run in years. This post is the map of what I built and why; the rest of the series goes deep on each piece.

The itch

I've integrated with OIDC providers plenty of times — configured redirect URIs, validated JWTs, cursed at claim mappings. But integrating with a black box teaches you the client half of the protocol and leaves the server half as folklore. What does the authorization server actually do between /authorize and /token? Where do refresh tokens live? What breaks when you rotate signing keys? I wanted to know by building, not by reading.

What got built

A small but complete OIDC ecosystem, five deployable pieces:

  • provider — an authorization server on Spring Authorization Server: registered clients, users, consent, token issuance, JWKS, an admin UI and admin API, Flyway-managed schema.
  • client — a relying-party web app on Spring Security's OAuth2 client: the classic login dance, server-side sessions, Thymeleaf.
  • resource — an edge gateway that validates JWTs it didn't issue: JWKS resolution, route-level authorization, trusted-header propagation, rate limiting.
  • sample-webapp — a "third-party" RP: what an external developer integrating with my IdP actually experiences — login, consent, calling the gateway with the user's token.
  • sample-m2m — machine-to-machine: client_credentials flow end to end.

Plus the plumbing that makes it feel real: a MySQL-backed compose harness for a prod profile, Kubernetes manifests, and an edge design for a cloud application gateway.

What "production-shaped" means here

A toy IdP is a weekend. A convincing one keeps pulling you deeper. The review backlog on this project reads like a real audit:

  • Session-authenticated admin API needed its own stateless security chain — CSRF-off plus cookies is a hole, not a convenience.
  • sub had to move from username to an immutable UUID — mutable subjects are account-confusion bugs waiting for a re-registered username.
  • client_secret_post had to die — secrets in request bodies end up in access logs.
  • Prod cookies needed secure/same-site set in config, not in a README checklist nobody re-reads.

Every one of those is a "oh, that's why the spec says that" moment — the kind you don't get from the client side.

The series

  1. This post — the architecture and the why.
  2. Spring Authorization Server from zero to first login.
  3. The relying party: Spring Security OAuth2 client, Thymeleaf and React variants.
  4. The edge gateway: validating tokens you didn't issue.
  5. Third parties: client_credentials, consent screens, and scope design.
  6. Operating it: health probes, observability, deploy manifests, and the security review that hurt.

Next up: standing up the provider — what Spring Authorization Server hands you for free, and the surprising amount it doesn't.

Monday, November 30, 2026

jq recipes you'll actually use

Companion cheatsheet with every recipe: jq quick reference — knowledge base entry.

You have JSON from an API, a CLI, a config file — and you need three fields out of it, flattened, without writing a script. That's the jq sweet spot: it reads JSON, applies a small filter language, and prints exactly what you asked for. Below are the patterns I reach for daily.

Reading fields

jq '.field'              # one field
jq '.a.b.c'              # nested
jq '.items[0]'           # first array element
jq '.[]'                 # every element

Shaping output

jq '.[] | {name, id}'                       # object per element
jq -r '.[] | [.id, .name] | @tsv'           # tab-separated rows
jq 'map(.name) | unique | sort'             # dedupe + sort

Filtering

jq '.[] | select(.x > 5)'
jq 'first(.[] | select(.active))'
jq '.[] | select(.name | test("^harbour-"))'

gh api + jq — the power combo

gh api 'orgs/ORG/repos?per_page=100' --jq '.[].name'
gh api repos/ORG/REPO/git/trees/main?recursive=1 --jq '.tree[].path'

--jq on gh api is exactly the same as piping to jq — it just saves a pipe.

Gotchas that bite everyone

  • .foo.bar dies on a null parent — use .foo?.bar or .foo // {}
  • select() filters, map() transforms — mixing them up is the #1 mistake
  • @tsv/@csv need -r or the output looks wrong
  • Piping one jq into another? Stay in JSON mode — only add -r at the end.

The full table of recipes — aggregation, objects, interpolation, conditionals — is in the KB entry.

Saturday, November 28, 2026

Markdown to Word without the template tax

Full writeup with reproducible steps: How to convert Markdown to Word (.docx) without templates — knowledge base entry.

Every so often a runbook, note, or tracking doc written in Markdown needs to reach someone who lives in Word. Pandoc works, but the output usually needs a manual cleanup pass — and corporate recipients just want a native .docx.

I packaged the conversion as a Devin/agent skill: simple-md-docx-converter. Feed it any well-formed .md file and it produces a Word document using native constructs — real headings, tables, code blocks, task lists — powered by python-docx. No template file, no placeholder contract to maintain.

  • Headings, lists (incl. task lists), tables, code fences, blockquotes, strikethrough, horizontal rules
  • <mark> highlighting, inline images, {{toc}} fields, page breaks
  • Multi-file merge into a single document
  • Mermaid diagrams render to images when mmdc/Kroki is available, else degrade to labelled text
  • Optional --template (.docx/.dotx or a named template) to inherit corporate styles and fill {{key}} tokens

Quick start:

git clone https://gitlab.com/shoujunni/skill-md-docx-converter.git
cd skill-md-docx-converter
./scripts/setup.sh
.venv/bin/python scripts/convert_md_to_docx.py input.md

The git workflow trick worth stealing: it degrades gracefully — if Mermaid tooling isn't installed, diagrams become clearly-labelled text instead of failing. Source and tests are on GitLab.

Java, JavaScript, HTML, XHTML, AJAX, CSS, etc.