1.0.0-0f32148 • Published 4 years ago

@kraken.js/auth v1.0.0-0f32148

Weekly downloads
159
License
MIT
Repository
github
Last release
4 years ago

@auth

Definition

directive @auth(rules: [AuthRule], silent: Boolean = true) on OBJECT | FIELD_DEFINITION

input AuthRule {
  # source of value
  args: String
  source: String
  authorizer: String
  # rules
  match: [String]
  truthy: Boolean
}

Usage Samples

Some usage samples

Authorizer must have property roles matching any

type SecureObject @auth(rules: [{ authorizer: "roles",  match: ["secure.read"] }]) { secureField: String }

Authorizer must be the owner of the object

type SecureObject @auth(rules: [{ authorizer: "sub",  source: "owner" }]) { secureField: String }

Authorizer groups allowed in the source object

type SecureObject @auth(rules: [{ authorizer: "groups",  source: "editors" }]) { secureField: String, editors: [String] }

Source object marked as public

type SecureObject @auth(rules: [{ source: "isPublic", truthy: true }]) { secureField: String, isPublic: Boolean }

User is creating an object setting as the owner (match with args)

Single value

type SecureObject { owner: String }
input CreateSecureObject { owner: String }

type Mutation { createSecureObject(input: CreateSecureObject): SecureObject @auth(rules: [
  { authorizer: "sub", args: "input.owner" }
])}

Multiple values

type SecureObject { owners: [String] }
input CreateSecureObject { owners: [String] }

type Mutation { createSecureObject(input: CreateSecureObject): SecureObject @auth(rules: [
  { authorizer: "sub", args: "input.owners" }
])}

Multiple rules

When configuring multiple rules if any of them evaluates as true the operation will authorize

type SecureObject @auth(rules: [
  { authorizer: "roles",  match: ["secure.read"] },
  { source: "isPublic",  truthy: true },
  { authorizer: "sub",  source: "owner" },
  { authorizer: "sub",  source: "readers" },
  { authorizer: "groups",  source: "readers" }
]) { secureField: String }
1.0.0-0f32148

4 years ago

1.0.0-5dccf74

4 years ago

0.0.6-1ce86fe

4 years ago

0.0.6-9e312f7

4 years ago

0.0.6-5a7fedf

4 years ago

0.0.6-b9fc49d

4 years ago

0.0.6-730877f

4 years ago

0.0.6-d282bc5

4 years ago

0.0.6-a032174

4 years ago

0.0.6-7783b12

4 years ago

0.0.6-a0c0d94

4 years ago

0.0.6-23e13b8

4 years ago

0.0.6-8735127

4 years ago

0.0.6-a423145

4 years ago

0.0.6-a8a3d2b

5 years ago

0.0.6-c999dee

5 years ago

0.0.6-f7489f8

5 years ago

0.0.6-db455b2

5 years ago

0.0.6-d89c3e3

5 years ago

0.0.6-88caa7a

5 years ago

0.0.6-dc46f62

5 years ago

0.0.6-fdf33df

5 years ago

0.0.6-d0f4162

5 years ago

0.0.6-b0b1b42

5 years ago

0.0.6-09cbfba

5 years ago

0.0.6-433184c

5 years ago

0.0.6-151db1e

5 years ago

0.0.6-3e948b8

5 years ago

0.0.6-950839d

5 years ago

0.0.6-072e508

5 years ago

0.0.5

5 years ago

0.0.5-189c1e2

5 years ago

0.0.5-50e5466

5 years ago

0.0.5-caee67b

5 years ago

0.0.5-b45b1f6

5 years ago

0.0.5-04a6021

5 years ago

0.0.5-4ff3204

5 years ago

0.0.5-4d631f5

5 years ago

0.0.5-ce7aa33

5 years ago

0.0.5-1e6181d

5 years ago

0.0.5-775b6f6

5 years ago

0.0.5-737c897

5 years ago

0.0.5-fd920ec

5 years ago

0.0.5-6188524

5 years ago

0.0.5-ee5cf97

5 years ago

0.0.5-94468a8

5 years ago

0.0.5-1de543a

5 years ago

0.0.5-c280766

5 years ago

0.0.5-cd55fd9

5 years ago

0.0.5-b01b05b

5 years ago

0.0.5-7fa83cb

5 years ago

0.0.5-59e2826

5 years ago

0.0.5-6a28701

5 years ago

0.0.5-8df7930

5 years ago

0.0.5-8d4580d

5 years ago

0.0.5-823a43f

5 years ago

0.0.5-b3afe68

5 years ago

0.0.5-4ea68a3

5 years ago

0.0.5-2d533e1

5 years ago

0.0.5-629917a

5 years ago

0.0.5-5fa6142

5 years ago

0.0.5-7045233

5 years ago

0.0.5-1e21840

5 years ago

0.0.5-8e51484

5 years ago

0.0.5-6c7f46f

5 years ago

0.0.5-3ad9e2f

5 years ago

0.0.5-117d74b

5 years ago

0.0.5-c378fe1

5 years ago

0.0.5-b248c32

5 years ago

0.0.5-aa2944c

5 years ago

0.0.4

5 years ago

0.0.4-3d82113

5 years ago

0.0.4-7bad9b9

5 years ago

0.0.4-228255d

5 years ago

0.0.4-5ed4dbe

5 years ago

0.0.4-b174638

5 years ago

0.0.4-351f689

5 years ago