Categorygithub.com/wirnat/go-keycloak-middleware
modulepackage
1.0.6
Repository: https://github.com/wirnat/go-keycloak-middleware.git
Documentation: pkg.go.dev

# README

Acknowledgements

Installation

Install using go module in your project

  go get github.com/wirnat/go-keycloak-middleware

Overview

  • Simple middleware for validating role from keycloak claims

  • Support for Echo handler

  • Support for Gin handler

  • Validate user using keycloak realm access

  • Validate user using keycloak resource access

Usage/Examples

//1.INIT Middleware instance
middleware := keycloak_middleware.NewKeyCloakMiddleware(keycloak_middleware.KeyCloakConfig{
	KeyCloakIP:   "localhost:8080",
	Realm:        "my-erp",
	ClientID:     "your client id",
	ClientSecret: "your client secret",
})

//2. Build a permission role
adminAccess := middleware.RealmAccess("admin_access").ResourceAccess("login").EchoGuard()

e := echo.New()

//3. implement it to your route
e.POST("login", func(c echo.Context) error {
	panic("something")
}, adminAccess)

e.Start(":8181")

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author

# Structs

No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author