This repository contains several implementations of an authorization library that takes key information about a user and the resource it attempts to access and validates whether this action is allowed or not.
These implementations are all in Go and their corresponding underlying authorization libraries are:
Implementations reside in ./auth where each of them have their own package. These all these libraries implement the AuthLib
interface at ./auth/auth.go and can be instantiated using the New<Library>Auth()
functions in each of the packages.
In each implementation, there is a test
directory that contains unit tests for that library, showcasing their usages.
In the ./pb directory, you can find a sample gRPC
server proto file with its message types and its corresponding Go output, compiled using gogo/protobuf's protoc-gen-gofast
plugin.
In ./service and ./client directories, you can find a Go implementation of the gRPC server described in Protobuf Files section and an example client implementation that connects to that server.
The server has the capability to use each of these libraries seamlessly. The client has no idea which auth library is used.
Run the server with:
go run service/daemon/main.go
The client is implemented as a unit test, so running that test will run the client code:
go test -run ^TestClientCreds$ github.com/umutozd/iam-prototypes/client