How to handle Permissions/roles with Golang web?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • mux

    Discontinued A powerful HTTP router and URL matcher for building Go web servers with 🦍

  • After authentication, i read the groups (azure ad) of the user via Graph API. The groups are mapped to internal roles and stored in a redis cluster. Key of the data in Redis is a Session-Id and the Id of the data (in this case sessionid + 'roles'). Each Microservice uses a small autorization function that is called before the desired functionality. This authorization function checks the redis data and either returns 401 or continues to the real handler. I am using https://github.com/gorilla/mux for handling http requests, but every other multiplexer library should be fine.

  • gin-auth-example

    Example cookie-based authentication with Gin

  • I used this as template https://github.com/Depado/gin-auth-example/blob/master/main.go

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • biscuit-rust

    Rust implementation of the Biscuit authorization token

  • gorbac

    goRBAC provides a lightweight role-based access control (RBAC) implementation in Golang.

  • chi

    lightweight, idiomatic and composable router for building Go HTTP services

  • Honestly the std lib net/http plus a router like Chi or gorilla/mux

  • Iris

    The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket:

  • Echo

    High performance, minimalist Go web framework

  • If you like the expressjs-like API of Fiber then you might like Echo

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts