Skip to content

baba2k/echo-keycloak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

echo-keycloak

Keycloak authorization middleware for echo v4

The echo-keycloak middleware validates a token given by header, query & url param or cookie with a keycloak server token endpoint and adds the token to context as *jwt.Token (default key is "user").

The echo-keycloak-roles middleware validates given roles with keycloak client or user roles and adds all roles to context as []string (default key is "roles").

General

  • echo-keycloak middleware must be executed before echo-keycloak-roles middleware
  • Context key of echo-keycloak middleware and echo-keycloak-roles middleware must be equal
  • Client and user roles are supported
  • The client or user must have one of the given roles to get access. Use multiple instances of echo-keycloak-roles middleware if a route requires multiple roles
  • Claim type in echo-keycloak middleware must be jwt.MapClaims (default) for echo-keycloak-roles middleware

Examples

Simple example

About

Keycloak authorization middleware for echo v4

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages