Skip to content

Nerzal/gocloak-echo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gocloak-echo

FOSSA Status

Keycloak handler & middleware for echo

This project is still WiP and the interfaces might change pretty often

Supported authentication flows:

  • Direct Grant Flow

Use this together with the keycloak client gocloak

Usage examples

  • Install the package
go get "github.com/Nerzal/gocloak/v8"
// AuthenticationHandler is used to authenticate with the api
type AuthenticationHandler interface {
	AuthenticateClient(Authenticate) (*gocloak.JWT, error)
	AuthenticateUser(Authenticate) (*gocloak.JWT, error)
	RefreshToken(Refresh) (*gocloak.JWT, error)
}
// AuthenticationMiddleWare is used to validate the JWT
type AuthenticationMiddleWare interface {
	CheckToken(next echo.HandlerFunc) echo.HandlerFunc
    CheckTokenCustomHeader(next echo.HandlerFunc) echo.HandlerFunc
	CheckScope(next echo.HandlerFunc) echo.HandlerFunc
    DecodeAndValidateToken(next echo.HandlerFunc) echo.HandlerFunc
}

Compatibility Matrix

This middleware uses echo and gocloak. Choose the right version for you

Versions Compatibility
gockloak-echo/v3 gocloak/v3, echo/v3
gockloak-echo/v4 gocloak/v3, echo/v4
gockloak-echo/v7 gocloak/v7, echo/v4
gockloak-echo/v8 gocloak/v8, echo/v4

License

FOSSA Status