summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/luxons/sevenwonders/config/AnonymousUsersHandshakeHandler.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/config/AnonymousUsersHandshakeHandler.java b/src/main/java/org/luxons/sevenwonders/config/AnonymousUsersHandshakeHandler.java
index 1132197d..bebbd477 100644
--- a/src/main/java/org/luxons/sevenwonders/config/AnonymousUsersHandshakeHandler.java
+++ b/src/main/java/org/luxons/sevenwonders/config/AnonymousUsersHandshakeHandler.java
@@ -4,11 +4,10 @@ import java.security.Principal;
import java.util.Map;
import org.springframework.http.server.ServerHttpRequest;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;
-import sun.security.acl.PrincipalImpl;
-
class AnonymousUsersHandshakeHandler extends DefaultHandshakeHandler {
private int playerId = 0;
@@ -16,9 +15,9 @@ class AnonymousUsersHandshakeHandler extends DefaultHandshakeHandler {
@Override
public Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler,
Map<String, Object> attributes) {
- Principal p = request.getPrincipal();
+ Principal p = super.determineUser(request, wsHandler, attributes);
if (p == null) {
- p = new PrincipalImpl("player" + playerId++);
+ p = new UsernamePasswordAuthenticationToken("player" + playerId++, null);
}
return p;
}
bgstack15