Add username from session to flow

Overview

The instruction in this document will describe how to fetch the value of the user_id set in the session.

When dumping the session to log you will notice that the user_id parameter is not located in the properties object, as the properties you set manually with SessionPropertyAddValve.

Requirements

The dump of the session will look something like this.

{
	"locale": "en",
	"id": "4bcd8ece-521c-4cc9-bdc5-13ff1b8d9d46",
	"created": "2021-10-23T13:10:10.848+02:00[Europe/Berlin]",
	"used": "2021-10-23T13:10:10.856+02:00[Europe/Berlin]",
	"properties": {
		"trace_id": ["#LVD1NgxIa3peWM5d"]
	},
	"user_id": "bobba",
	"language": "en",
	"assuranceLevel": "0",
	"source": "unknown",
	"challenge": "64a975e6-aeb7-40d4-bf09-94a951e5edd6"
}

Fetching the user_id

The user_id property can be fetched like all other session properties with {{session.PROPERTYNAME}}

{
	"name": "PropertyAddValve",
	"config": {
		"name": "userIDFromSession",
		"value": "{{session.user_id}}"
	}
}