Openfire with Spring MVC and strophejs

I’m implementing an chat application using openfire and spring mvc with strophejs. i’m using the same user table for openfire and spring mvc now the issue is i’m authenticating the user using spring after successful authentication i need to connect the user with openfire server using strophejs, now it’s required put the username and password again which i can’t directly provide to javascript for security reason. Now how can i manage to login the user in both servers with single authentication and later attach the openfire session with strophejs so i don’t need to pass the user credentials to javascript ?