Skip to content
Snippets Groups Projects
Commit 872227c9 authored by Gerviba's avatar Gerviba
Browse files

Fix dependency

parent 1339a163
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ AuthSch Java API ...@@ -2,7 +2,7 @@ AuthSch Java API
=== ===
![Coverage: 80.3%](https://img.shields.io/badge/coverage-80.3%25-green.svg) ![Coverage: 80.3%](https://img.shields.io/badge/coverage-80.3%25-green.svg)
![Version: 1.0.0-RELEASE](https://img.shields.io/badge/version-1.0.0--RELEASE-blue.svg) ![Version: 1.0.0-RELEASE](https://img.shields.io/badge/version-1.0.0-blue.svg)
![BEER-WARE](https://img.shields.io/badge/license-BEER--WARE-yellow.svg) ![BEER-WARE](https://img.shields.io/badge/license-BEER--WARE-yellow.svg)
## Usage ## Usage
...@@ -12,17 +12,9 @@ AuthSch Java API ...@@ -12,17 +12,9 @@ AuthSch Java API
- You need to have an auth.sch account. - You need to have an auth.sch account.
- Register a new application. - Register a new application.
- Include the api to your project - Include the api to your project
- Note that this project is depends on gson library: - Note that this project is depends on gson 2.6.2 library.
```XML If you're using a web container, you might need to put a [gson-2.6.2.jar](https://repo1.maven.org/maven2/com/google/code/gson/gson/2.6.2/) into the `WEB-INF/lib` folder.
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
```
If you're using a web container, you might need to put a [gson-2.8.2.jar](https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.2/) into the `WEB-INF/lib` folder.
### Initialize ### Initialize
...@@ -63,9 +55,29 @@ It will return a new AuthRespone instance. ...@@ -63,9 +55,29 @@ It will return a new AuthRespone instance.
ProfileDataResponse profile = api.getProfile(accessToken); ProfileDataResponse profile = api.getProfile(accessToken);
``` ```
## Maven shade ## Maven
### Compiled JAR
pom.xml
```XML
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>hu.sch</groupId>
<artifactId>authsch</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/authsch-1.0.0.jar</systemPath>
</dependency>
```
You need to put the `authsch-x.x.x.jar` (and maybe the `gson-2.6.2.jat`) into the `WEB-INF/lib` folder.
TODO
## List of projects ## List of projects
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>hu.gerviba</groupId> <groupId>hu.gerviba</groupId>
<artifactId>authsch</artifactId> <artifactId>authsch</artifactId>
<version>1.0.0-RELEASE</version> <version>1.0.0</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.8.2</version> <version>2.6.2</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -23,6 +23,7 @@ import java.util.UUID; ...@@ -23,6 +23,7 @@ import java.util.UUID;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import com.google.gson.Gson;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
...@@ -201,10 +202,10 @@ public class AuthSchAPI implements Serializable { ...@@ -201,10 +202,10 @@ public class AuthSchAPI implements Serializable {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
ProfileDataResponse mapProfileDataResponse(String rawJson) { ProfileDataResponse mapProfileDataResponse(String rawJson) {
JsonParser jsonParser = new JsonParser(); Gson gson = new Gson();
try { try {
JsonObject obj = jsonParser.parse(rawJson).getAsJsonObject(); JsonObject obj = gson.fromJson(rawJson, JsonElement.class).getAsJsonObject();
ProfileDataResponseBuilder response = ProfileDataResponse.newBuilder(); ProfileDataResponseBuilder response = ProfileDataResponse.newBuilder();
response.setInternalId(UUID.fromString(obj.get("internal_id").getAsString())); response.setInternalId(UUID.fromString(obj.get("internal_id").getAsString()));
...@@ -372,10 +373,10 @@ public class AuthSchAPI implements Serializable { ...@@ -372,10 +373,10 @@ public class AuthSchAPI implements Serializable {
} }
AuthResponse mapAuthResponse(String rawJson) { AuthResponse mapAuthResponse(String rawJson) {
JsonParser jsonParser = new JsonParser(); Gson gson = new Gson();
try { try {
JsonObject obj = jsonParser.parse(rawJson).getAsJsonObject(); JsonObject obj = gson.fromJson(rawJson, JsonElement.class).getAsJsonObject();
return new AuthResponse( return new AuthResponse(
obj.get("access_token").getAsString(), obj.get("access_token").getAsString(),
obj.get("expires_in").getAsLong(), obj.get("expires_in").getAsLong(),
...@@ -388,10 +389,10 @@ public class AuthSchAPI implements Serializable { ...@@ -388,10 +389,10 @@ public class AuthSchAPI implements Serializable {
} }
AuthResponse mapAuthResponse(String rawJson, String parameters) { AuthResponse mapAuthResponse(String rawJson, String parameters) {
JsonParser jsonParser = new JsonParser(); Gson gson = new Gson();
try { try {
JsonObject obj = jsonParser.parse(rawJson).getAsJsonObject(); JsonObject obj = gson.fromJson(rawJson, JsonElement.class).getAsJsonObject();
return new AuthResponse( return new AuthResponse(
obj.get("access_token").getAsString(), obj.get("access_token").getAsString(),
obj.get("expires_in").getAsLong(), obj.get("expires_in").getAsLong(),
......
...@@ -47,6 +47,7 @@ public enum Scope { ...@@ -47,6 +47,7 @@ public enum Scope {
* visszatérésre az ezt tartalmazó engedélykérés), csak indokolt esetben, központi * visszatérésre az ezt tartalmazó engedélykérés), csak indokolt esetben, központi
* engedélyezés után használható (ehhez adj fel egy ticketet a support.sch.bme.hu * engedélyezés után használható (ehhez adj fel egy ticketet a support.sch.bme.hu
* oldalon, amelyben leírod hogy mihez és miért van rá szükséged. * oldalon, amelyben leírod hogy mihez és miért van rá szükséged.
* @warning Külön engedélyeztetni kell.
*/ */
NEPTUN_CODE("niifPersonOrgID"), NEPTUN_CODE("niifPersonOrgID"),
/** /**
......
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment