working in rest router and in middleware for get current user