I am using ModeShape 2.8.2 and modeshape is automatically using the principal's name from the jaas security context as value for createdBy and lastModifiedBy properties.
Is it possible to change this behaviour in some way? E.g. in our environment the principal's name is the login name for the application. And I cannot change that. But I'd prefer to use the user's database id instead of his login name as property value in ModeShape.
We use a custom principal which also knows a surrogate in addition to the name.
There really is no way to alter the session's username, which is derived from the JAAS Principal used for authentication. The only way is to either create a session with the user's credentials, or create a custom authentication provider. For details, see our 2.x documentation on Authentication and Authorization Providers.