Commit 71e20144 authored by Matija Obreza's avatar Matija Obreza

Updating dependencies

parent 8892a486
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
<servlet-api.version>2.5</servlet-api.version> <servlet-api.version>2.5</servlet-api.version>
<jsp-api.version>2.1</jsp-api.version> <jsp-api.version>2.1</jsp-api.version>
<hibernate.version>4.2.7.SP1</hibernate.version> <hibernate.version>4.3.6.Final</hibernate.version>
<hibernate.annotations.version>4.0.4.Final</hibernate.annotations.version> <hibernate.annotations.version>4.0.5.Final</hibernate.annotations.version>
<hsqldb.version>2.3.1</hsqldb.version> <hsqldb.version>2.3.1</hsqldb.version>
<ehcache.version>2.7.4</ehcache.version> <ehcache.version>2.7.4</ehcache.version>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<org.springframework.social-version>1.0.3.RELEASE</org.springframework.social-version> <org.springframework.social-version>1.0.3.RELEASE</org.springframework.social-version>
<org.springframework.social-google-version>1.0.0.M3</org.springframework.social-google-version> <org.springframework.social-google-version>1.0.0.M3</org.springframework.social-google-version>
<mysql.version>5.1.25</mysql.version> <mysql.version>5.1.31</mysql.version>
<oval.version>1.81</oval.version> <oval.version>1.81</oval.version>
<jackson.version>2.2.1</jackson.version> <jackson.version>2.2.1</jackson.version>
...@@ -120,19 +120,6 @@ ...@@ -120,19 +120,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${jsonpath.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>${jsonpath.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>commons-beanutils</groupId> <groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId> <artifactId>commons-beanutils</artifactId>
...@@ -183,6 +170,12 @@ ...@@ -183,6 +170,12 @@
<version>${log4j.version}</version> <version>${log4j.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!--Servlet and portal dependencies --> <!--Servlet and portal dependencies -->
<dependency> <dependency>
<groupId>javax.servlet.jsp</groupId> <groupId>javax.servlet.jsp</groupId>
...@@ -223,6 +216,12 @@ ...@@ -223,6 +216,12 @@
<artifactId>spring-aop</artifactId> <artifactId>spring-aop</artifactId>
<version>${spring.framework.version}</version> <version>${spring.framework.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
...@@ -269,65 +268,11 @@ ...@@ -269,65 +268,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.social</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-social-google</artifactId> <artifactId>spring-data-jpa</artifactId>
<version>${org.springframework.social-google-version}</version> <version>1.6.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-web</artifactId>
<version>${org.springframework.social-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>${org.springframework.social-version}</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-servlet</artifactId>
<version>1.17.0-rc</version>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.googlecode.googleplus</groupId>
<artifactId>google-plus-java-api</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</exclusion>
</exclusions>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.api.client</groupId>
<artifactId>google-api-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</exclusion>
</exclusions>
<version>1.3.1-alpha</version>
</dependency> </dependency>
<!-- Hibernate dependencies --> <!-- Hibernate dependencies -->
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
...@@ -424,11 +369,6 @@ ...@@ -424,11 +369,6 @@
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
<version>2.3</version> <version>2.3</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId> <artifactId>commons-collections4</artifactId>
...@@ -439,11 +379,6 @@ ...@@ -439,11 +379,6 @@
<artifactId>mail</artifactId> <artifactId>mail</artifactId>
<version>1.5.0-b01</version> <version>1.5.0-b01</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.fernandospr</groupId>
<artifactId>javapns-jdk16</artifactId>
<version>2.2.1</version>
</dependency>
<dependency> <dependency>
<groupId>com.google.api-client</groupId> <groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId> <artifactId>google-api-client</artifactId>
...@@ -482,11 +417,7 @@ ...@@ -482,11 +417,7 @@
<artifactId>org.bioversityinternational.ontology</artifactId> <artifactId>org.bioversityinternational.ontology</artifactId>
<version>0.6.2</version> <version>0.6.2</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.6.2.RELEASE</version>
</dependency>
<dependency> <dependency>
<groupId>org.jamel.dbf</groupId> <groupId>org.jamel.dbf</groupId>
<artifactId>dbf-reader</artifactId> <artifactId>dbf-reader</artifactId>
...@@ -499,11 +430,78 @@ ...@@ -499,11 +430,78 @@
<version>${jetty.version}</version> <version>${jetty.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>com.jayway.jsonpath</groupId>
<artifactId>jcl-over-slf4j</artifactId> <artifactId>json-path</artifactId>
<version>${slf4j.version}</version> <version>${jsonpath.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>${jsonpath.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-google</artifactId>
<version>${org.springframework.social-google-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-web</artifactId>
<version>${org.springframework.social-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>${org.springframework.social-version}</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-servlet</artifactId>
<version>1.17.0-rc</version>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.googlecode.googleplus</groupId>
<artifactId>google-plus-java-api</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</exclusion>
</exclusions>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.api.client</groupId>
<artifactId>google-api-client</artifactId>
<exclusions>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</exclusion>
</exclusions>
<version>1.3.1-alpha</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -26,7 +26,6 @@ import org.apache.commons.lang.RandomStringUtils; ...@@ -26,7 +26,6 @@ import org.apache.commons.lang.RandomStringUtils;
import org.genesys2.server.model.impl.User; import org.genesys2.server.model.impl.User;
import org.genesys2.server.service.UserService; import org.genesys2.server.service.UserService;
import org.genesys2.server.servlet.util.GoogleOAuthUtil; import org.genesys2.server.servlet.util.GoogleOAuthUtil;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -64,7 +63,7 @@ public class GoogleSocialController extends BaseController { ...@@ -64,7 +63,7 @@ public class GoogleSocialController extends BaseController {
String accessToken = null; String accessToken = null;
try { try {
accessToken = googleOAuthUtil.exchangeForAccessToken(request); accessToken = googleOAuthUtil.exchangeForAccessToken(request);
} catch (IOException | JSONException e) { } catch (IOException e) {
_logger.warn(e.getMessage(), e); _logger.warn(e.getMessage(), e);
} }
......
...@@ -35,8 +35,6 @@ import org.apache.http.client.methods.HttpPost; ...@@ -35,8 +35,6 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
...@@ -48,11 +46,16 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; ...@@ -48,11 +46,16 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.social.google.api.userinfo.GoogleUserInfo; import org.springframework.social.google.api.userinfo.GoogleUserInfo;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component @Component
public class GoogleOAuthUtil { public class GoogleOAuthUtil {
private static final Log LOG = LogFactory.getLog(GoogleOAuthUtil.class); private static final Log LOG = LogFactory.getLog(GoogleOAuthUtil.class);
public static final String LOCAL_GOOGLEAUTH_PATH = "/google/auth"; public static final String LOCAL_GOOGLEAUTH_PATH = "/google/auth";
private ObjectMapper mapper=new ObjectMapper();
@Value("${base.url}") @Value("${base.url}")
private String baseUrl; private String baseUrl;
...@@ -66,7 +69,7 @@ public class GoogleOAuthUtil { ...@@ -66,7 +69,7 @@ public class GoogleOAuthUtil {
@Named("authUserDetailsService") @Named("authUserDetailsService")
private UserDetailsService userDetailsService; private UserDetailsService userDetailsService;
public String exchangeForAccessToken(HttpServletRequest request) throws IOException, JSONException { public String exchangeForAccessToken(HttpServletRequest request) throws IOException {
final HttpClient httpclient = new DefaultHttpClient(); final HttpClient httpclient = new DefaultHttpClient();
final HttpPost httppost = new HttpPost("https://accounts.google.com/o/oauth2/token"); final HttpPost httppost = new HttpPost("https://accounts.google.com/o/oauth2/token");
...@@ -87,9 +90,10 @@ public class GoogleOAuthUtil { ...@@ -87,9 +90,10 @@ public class GoogleOAuthUtil {
for (String line = null; (line = reader.readLine()) != null;) { for (String line = null; (line = reader.readLine()) != null;) {
builder.append(line).append("\n"); builder.append(line).append("\n");
} }
final JSONObject jsonObject = new JSONObject(builder.toString());
return jsonObject.has("access_token") ? jsonObject.getString("access_token") : null; JsonNode json = mapper.readTree(builder.toString());
return json.has("access_token") ? json.get("access_token").textValue() : null;
} }
public String getAuthenticationUrl() { public String getAuthenticationUrl() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment