Skip to content

Instantly share code, notes, and snippets.

@ktutnik
Last active May 7, 2021 21:39
Show Gist options
  • Save ktutnik/24a79e8c65e0b59cce8f6fbae670df64 to your computer and use it in GitHub Desktop.
Save ktutnik/24a79e8c65e0b59cce8f6fbae670df64 to your computer and use it in GitHub Desktop.
authPolicy()
.register("ShopOwner", ctx => {
// ctx.user is claims of JWT token
// from Authorization request header
return ctx.user?.role === "ShopOwner"
})
// chain to register another policy
.register("Staff", ctx => {
return ctx.user?.role === "Staff"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment