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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user