Documentation ¶
Overview ¶
Description: This package provides a set of constants and functions to help manage inter-microservice, authorization-related tasks in Fabriktor. Sensitive authorization code is not included in this package and is kept at the service level. Single microservice authorization code is not included in this package, and it is kept at the service level. This package is not related in any way to authentication.
Index ¶
Constants ¶
const ( NA = iota Reader Writer Owner )
Roles.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key string
const ( PubSubServiceNameKey Key = "serviceName" PubSubCollectionNameKey Key = "collectionName" PubSubQueryKey Key = "query" PubSubLookupKey Key = "lookup" PubSubPrincipalIDKey Key = "principalID" PubSubRoleKey Key = "role" )
Attributes-related constants for the Authorization webhook. These constants indicate what information the webhook needs to retrieve using the exchanger adapter.
Asynchronous authorization is performed when an event in one microservice requires authorization entities in another microservice to be modified.
Example Scenario: If document `X` in microservice `A` is updated, and documents in microservice `B` owned by the same owner as document `X` must be updated, a Pub/Sub message is sent to the Authorization microservice. The message includes the following attributes, indicating that the exchanger adapter of the Authorization microservice should query microservice `B` to retrieve the `PubSubLookupKey` field for all relevant documents.
The query is constructed using the following attributes:
- PubSubServiceNameKey: The name of the target service.
- PubSubCollectionNameKey: The name of the target collection.
- PubSubQueryKey: The query parameters to filter the result set.
- PubSubLookupKey: The field to look up in the result set.
- PubSubActionKey: The action to perform, either append or override.
- PubSubPrincipalIDKey: The principal ID to be utilized when performing the action.
- PubSubRoleKey: The role to be utilized when performing the action with the principal.
Example path formed by these attributes:
- /serviceB/collectionB?query={"owner":"ownerX"}
type LookupField ¶
type LookupField string
const (
LookupFieldMongoDBID LookupField = "_id"
)
Lookup fields.