Skip to content

role

role checks roles in the parsed claims stored by a previous authentication middleware, usually session.

yaml
server:
  http:
    middlewares:
      require_admin:
        role:
          roles:
            - admin
          methods:
            - GET
            - POST
FieldDefaultDescription
rolesAny one listed role is enough to pass. Empty means no role check.
methodsallRestrict the check to these HTTP methods. Other methods continue.
noopfalseDisable the check and always continue.

role expects claims to implement Turna's role interface. Put session before role in the router chain.