Hi Ayah,
Mendix by default already has sessionTimeout. So, users are logged out by default after the session timed out.
https://docs.mendix.com/refguide/tricky-custom-runtime-settings#2-2-general-settings
See above link. If you want to reduce the session time out for users, you can change this setting to the desired value.
If you have custom requirement where, only certain type of users must have reduced session timeout, then you must program this in Java with Mendix Core API.