Skip to content

Add configuration to enforce creation of things in certain namespaces must use a "definition" with a specified regex #2189

@thjaeckle

Description

@thjaeckle

One sometimes has the need to be very strict on which types of "Things" should be creatable in Ditto.

There are already configuration options to only allow creation of things in certain defined namespaces - it can also be configured which authenticated subjects may create new things.

What however is not yet possible to define is to enforce that a "definition" must be provided when creating a thing.
Together with the WoT (Web of Things) based validation, providing such a configuration option would enable that the administrator / operator of Ditto has much control over what kind of things get created.

Suggestion for providing this configuration would be to extend the existing entity-creation config:

ditto.entity-creation {
   # this default entry allows every authenticated "auth-subject" to create any "resource-type" in any "namespace":
  grant = [
    {
      resource-types = [
        "thing"
      ]
      namespaces = [
        "org.eclipse.ditto*"
      ]
      auth-subjects = [
        "pre:ditto-*"
      ]
      # thing-definitions would only be applied for "thing" resources:
      thing-definitions= [
        null, # defining null would allow also to provide no definition - if this is missing from the list, a definition has to be provided
        "https://eclipse-ditto.github.io/ditto-examples/wot/models/floor-lamp-*"
      ]
    }
  ]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions