Add DestinationUserNameProvider interface

The interface is to be implemented in addition to
java.security.Principal when Principal.getName() is not globally unique
enough for use in user destinations.

Issue: SPR-11327
This commit is contained in:
Rossen Stoyanchev
2014-01-21 11:50:04 -05:00
parent 2cafe9d73a
commit e4ad2b352e
5 changed files with 117 additions and 27 deletions

View File

@@ -165,7 +165,9 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
return true;
}
protected String getTargetDestination(String origDestination, String targetDestination, String sessionId, String user) {
protected String getTargetDestination(String origDestination, String targetDestination,
String sessionId, String user) {
return targetDestination + "-user" + sessionId;
}

View File

@@ -0,0 +1,20 @@
package org.springframework.messaging.simp.user;
/**
* An interface to be implemented in addition to {@link java.security.Principal}
* when {@link java.security.Principal#getName()} is not globally unique enough
* for use in user destinations. For more on user destination see
* {@link org.springframework.messaging.simp.user.UserDestinationResolver}.
*
* @author Rossen Stoyanchev
* @since 4.0.1
*/
public interface DestinationUserNameProvider {
/**
* Return the (globally unique) user name to use with user destinations.
*/
String getDestinationUserName();
}