From 89af6c4ecbd5fd9cfb0b60a01bcc6a7c872a0efd Mon Sep 17 00:00:00 2001
From: Daniel Gerhardt <code@dgerhardt.net>
Date: Thu, 17 Aug 2017 15:31:24 +0200
Subject: [PATCH] Migrate to Pac4j version 2.1

---
 pom.xml                                                    | 4 ++--
 src/main/java/de/thm/arsnova/entities/User.java            | 2 +-
 src/test/java/de/thm/arsnova/services/UserServiceTest.java | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 00290b8d3..b3e759f9b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -217,12 +217,12 @@
 		<dependency>
 			<groupId>org.pac4j</groupId>
 			<artifactId>spring-security-pac4j</artifactId>
-			<version>2.1.2</version>
+			<version>3.0.0</version>
 		</dependency>
 		<dependency>
 			<groupId>org.pac4j</groupId>
 			<artifactId>pac4j-oauth</artifactId>
-			<version>1.9.7</version>
+			<version>2.1.0</version>
 		</dependency>
 		<dependency>
 			<groupId>com.corundumstudio.socketio</groupId>
diff --git a/src/main/java/de/thm/arsnova/entities/User.java b/src/main/java/de/thm/arsnova/entities/User.java
index c3ed9bf78..21954341a 100644
--- a/src/main/java/de/thm/arsnova/entities/User.java
+++ b/src/main/java/de/thm/arsnova/entities/User.java
@@ -57,7 +57,7 @@ public class User implements Serializable {
 	}
 
 	public User(FacebookProfile profile) {
-		setUsername(profile.getProfileUrl());
+		setUsername(profile.getProfileUrl().toString());
 		setType(User.FACEBOOK);
 	}
 
diff --git a/src/test/java/de/thm/arsnova/services/UserServiceTest.java b/src/test/java/de/thm/arsnova/services/UserServiceTest.java
index 2421f52bb..bb1c1a04c 100644
--- a/src/test/java/de/thm/arsnova/services/UserServiceTest.java
+++ b/src/test/java/de/thm/arsnova/services/UserServiceTest.java
@@ -23,9 +23,9 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.BlockJUnit4ClassRunner;
 import org.pac4j.oauth.profile.JsonHelper;
-import org.pac4j.oauth.profile.google2.Google2AttributesDefinition;
 import org.pac4j.oauth.profile.google2.Google2Email;
 import org.pac4j.oauth.profile.google2.Google2Profile;
+import org.pac4j.oauth.profile.google2.Google2ProfileDefinition;
 import org.springframework.security.authentication.AnonymousAuthenticationToken;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.GrantedAuthority;
@@ -62,8 +62,8 @@ public class UserServiceTest {
 		ArrayList<Google2Email> emails = new ArrayList<>();
 		emails.add(email);
 		Google2Profile profile = new Google2Profile();
-		profile.addAttribute(Google2AttributesDefinition.DISPLAY_NAME, "ptsr00");
-		profile.addAttribute(Google2AttributesDefinition.EMAILS, JsonHelper.toJSONString(emails));
+		profile.addAttribute(Google2ProfileDefinition.DISPLAY_NAME, "ptsr00");
+		profile.addAttribute(Google2ProfileDefinition.EMAILS, emails);
 
 		socketid2user.put(UUID.randomUUID(), new User(profile));
 		List<GrantedAuthority> authorities = new ArrayList<>();
-- 
GitLab