summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorjbion <joffrey.bion@amadeus.com>2016-12-21 20:06:29 +0100
committerjbion <joffrey.bion@amadeus.com>2016-12-21 20:06:29 +0100
commit3ca053899bc57e92e7b3a0accc3f96fa0c834196 (patch)
treeb12497c72c744fe27816708a4f5f7b73780c9cf6 /src/main/java
parentAdd potential extra wonders (diff)
downloadseven-wonders-3ca053899bc57e92e7b3a0accc3f96fa0c834196.tar.gz
seven-wonders-3ca053899bc57e92e7b3a0accc3f96fa0c834196.tar.bz2
seven-wonders-3ca053899bc57e92e7b3a0accc3f96fa0c834196.zip
Remove PrincipalImpl usage, using spring security instead
Diffstat (limited to 'src/main/java')
-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