My Goal - To send message to single user if possible without using spring security
I want to input a username from user and set it as username in spring security so that I can use method convertAndSendToUser
. I searched on the net and found two approaches
- Using
DefaultHandshakeHandler
to set username but this way I am unable to retrieve user input from the page and use it indetermineUser
method I have tried using following piece of code
Authentication request = new UsernamePasswordAuthenticationToken("xyz", null); SecurityContextHolder.getContext().setAuthentication(request);
But it is not working as it is just changing the username for that method and then it resets the username. If possible is there any approach with which I can send message to single user without using spring security. Thanks in advance
P.S. I am a newbee.