The connection factory is a request-scoped bean, so it is created at request-time for the currently signed in user. (That's why its constructor-arg...which is fed into the createConnectionRepository() method of the usersConnectionRepository bean...is given a value to uniquely identify the current user.
In the code you pasted in, the uniquely identifying value is the name of the user principal. But it could be anything, depending on what security mechanism you're using...we don't tie you down to any specific security framework, but you must provide a value here that identifies the current user from whatever security framework you have in place.
So, my question to you is: How can you, at request time, know who the current user is? You say it's their email address. That's fine, but how would you know what that is? If you were writing a Spring MVC controller and wanted to get the user's email address from the request, how would you do that? The answer to that question is likely the same answer for what you'd wire in for the user ID (using an appropriate SpEL expression if in XML or through other means if you configure this in JavaConfig).
Spring Social Project Lead