From 3ca053899bc57e92e7b3a0accc3f96fa0c834196 Mon Sep 17 00:00:00 2001 From: jbion Date: Wed, 21 Dec 2016 20:06:29 +0100 Subject: Remove PrincipalImpl usage, using spring security instead --- .../luxons/sevenwonders/config/AnonymousUsersHandshakeHandler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java') 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 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; } -- cgit