Skip to content

timdrysdale/gojans

Repository files navigation

alt text

A golang client adapter for Janssen Project services, starting with the jans-auth-server

[Go, golang, Janssen, Gluu, oxAuth, jans-auth-server]

stability-experimental Go Reference alt text GitHub license

For questions either raise an issue or visit the gopher-slack channel #gojans

Background

Janssen (jans for short) is a Linux Foundation project providing a cloud-native identity and access management (IAM) platform, building on code developed and donated by Gluu. If you are still considering possible alternatives, then you should read this opinion about what Redhat dropping CENTOS means for its sibling keycloak.

About

This adapter aims to ease the task of building golang clients which interact with jans, in much the same way that gocloak does for keycloak. A key difference is that gojans is auto-generated, whereas gocloak is crafted by hand. The steps to create gojans require some human intervention, so this repo exists to save you the hassle. The procedure is

  • start with openapi3.0 spec for Gluu oxAuth server 4.2,
  • convert to openapi2.0/swagger2.0 using apimatic.io
  • modify by hand to clean up the naming and some type defintions
  • generate client code with go-swagger

Usage

To use the client code in your project, import

import (
	jac "github.com/timdrysdale/gojans/pkg/jansAuth/client"
	jam "github.com/timdrysdale/gojans/pkg/jansAuth/models"
)

Project Organisation

The swagger files are in ./api/openapi-spec. The client adapter code is in .pkg/jansAuth. The project directory tree is:

.
├── api
│   └── openapi-spec
├── img
├── internal
│   └── curl
└── pkg
    └── jansAuth
        ├── client
        └── models

CI

You can pre-run the linting with

golangci-lint run ./...  

Using act may fail on your local machine due to cgo dependencies.

Mocking / Testing

Test with your own instantiation of the auth-server, or consider mocking (perhaps automatically with apisprout although it may require the examples to be updated for more complete testing).

About

Go adapter for Janssen auth server (golang, Gluu, jans)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published