Skip to content

Commit d7713b7

Browse files
committed
Released Version 11.0.1
1 parent 9655003 commit d7713b7

23 files changed

+44
-10
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
> **LoginRadius Java SDK Change Log** provides information regarding what has changed, more specifically what changes, improvements and bug fix has been made to the SDK. For more details please refer to the [LoginRadius API Documention(https://www.loginradius.com/docs/api/v2/deployment/sdk-libraries/java-library/)
22
3+
# Version 11.0.1
4+
Release on March 17, 2021
5+
6+
## Enhancements
7+
8+
- Added X-Origin-IP header support.
9+
- Added 429 error code handling for "Too Many Request in a particular time frame".
10+
11+
312
# Version 11.0.0
413
Released on **Aug 21, 2020**
514

LoginRadius-JavaSDK/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.loginradius.sdk</groupId>
88
<artifactId>java-sdk</artifactId>
9-
<version>11.0.0</version>
9+
<version>11.0.1</version>
1010
<description>LoginRadius java SDK contains registration and social APIs</description>
1111
<url>https://github.com/LoginRadius/java-sdk</url>
1212

@@ -131,4 +131,4 @@
131131
</build>
132132

133133

134-
</project>
134+
</project>

LoginRadius-JavaSDK/src/main/java/com/loginradius/sdk/helper/LoginRadiusRequest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ private static String LoginRadiusRequestRunner(String method, String url, String
9797
con.setRequestProperty("Authorization", "Bearer " + authorization);
9898
authorization = "";
9999
}
100+
if(LoginRadiusSDK.getOriginIp()!=null && LoginRadiusSDK.getOriginIp()!="") {
101+
con.setRequestProperty("X-Origin-IP", LoginRadiusSDK.getOriginIp());
102+
103+
}
100104
if (!apiSecret.equals("") && LoginRadiusSDK.getRequestSigning()) {
101105
String time = getTime();
102106
con.setRequestProperty("X-Request-Expires", time);
@@ -124,7 +128,10 @@ private static String LoginRadiusRequestRunner(String method, String url, String
124128
if (responseCode == HttpURLConnection.HTTP_OK) {
125129
code = responseCode;
126130
return readStream(con.getInputStream(), con.getContentEncoding());
127-
} else {
131+
} else if(responseCode == 429){
132+
code = 106;
133+
return "Too Many Request in a particular time frame";
134+
}else {
128135
code = responseCode;
129136
return readStream(con.getErrorStream(), con.getContentEncoding());
130137
}
@@ -231,6 +238,11 @@ private static ErrorResponse exception(String error) {
231238
obj.setErrorCode(105);
232239
obj.setMessage("IOException");
233240
break;
241+
case 106:
242+
obj.setDescription(error);
243+
obj.setErrorCode(106);
244+
obj.setMessage("TOO_MANY_REQUESTS");
245+
break;
234246
default:
235247
TypeToken<ErrorResponse> typeToken = new TypeToken<ErrorResponse>() {
236248
};

LoginRadius-JavaSDK/src/main/java/com/loginradius/sdk/util/ErrorResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public Object getData() {
151151

152152
/**
153153
*
154-
* @param Data The Data
154+
* @param Errors The Data
155155
*/
156156

157157
public void setData(Object Data) {

LoginRadius-JavaSDK/src/main/java/com/loginradius/sdk/util/LoginRadiusSDK.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.Map;
44
import java.util.TreeMap;
55

6+
67
public class LoginRadiusSDK {
78
private LoginRadiusSDK() {
89
}
@@ -16,7 +17,7 @@ public static class Initialize {
1617
private static String apiSecret;
1718
private static Boolean apiRequestSigning = false;
1819
private static String apiRegion;
19-
20+
private static String originIp;
2021
public static void setApiKey(final String apiKey) {
2122
Initialize.apiKey = apiKey;
2223
}
@@ -36,6 +37,9 @@ public static void setCustomDomain(final String domain) {
3637
public static void setApiRegion(final String apiRegion) {
3738
Initialize.apiRegion = apiRegion;
3839
}
40+
public static void setOriginIp(final String originIp) {
41+
Initialize.originIp = originIp;
42+
}
3943
}
4044

4145
public static String getApiKey() {
@@ -61,7 +65,10 @@ public static String getConfigDomain() {
6165
public static String getApiRegion() {
6266
return Initialize.apiRegion;
6367
}
64-
68+
public static String getOriginIp() {
69+
return Initialize.originIp;
70+
}
71+
6572
public static boolean validate() {
6673
return Initialize.apiKey == null || Initialize.apiKey.length() == 0 || Initialize.apiSecret == null
6774
|| Initialize.apiSecret.length() == 0 ? false : true;

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Use the following dependency in your project:
2828
<dependency>
2929
<groupId>com.loginradius.sdk</groupId>
3030
<artifactId>java-sdk</artifactId>
31-
<version>11.0.0</version>
31+
<version>11.0.1</version>
3232
</dependency>
3333
3434
```
@@ -75,6 +75,12 @@ init.setApiKey("<your-loginradius-api-key>");
7575
init.setApiSecret("<your-loginradius-api-secret>");
7676
```
7777

78+
LoginRadius allows you add X-Origin-IP in your headers and it determines the IP address of the client's request,this can also be useful to overcome analytics discrepancies where the analytics depend on header data.
79+
80+
```
81+
init.setOriginIp("<Client-Ip-Address>");
82+
```
83+
7884
### Custom Domain
7985
When initializing the SDK, optionally specify a custom domain.
8086

demo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<dependency>
5353
<groupId>com.loginradius.sdk</groupId>
5454
<artifactId>java-sdk</artifactId>
55-
<version>11.0.0</version>
55+
<version>11.0.1</version>
5656
</dependency>
5757
</dependencies>
5858

demo/src/main/java/com/demo/LoginRadiusService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,4 +621,4 @@ private String getSott() {
621621
return "";
622622
}
623623
}
624-
}
624+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
server.port= 8080
22
app.apikey= xxxxxxx -xxxxxxx
3-
app.apisecret= xxxxxx-xxxxxxx
3+
app.apisecret= xxxxxx-xxxxxxx

demo/src/main/resources/static/css/style.css

100644100755
File mode changed.

0 commit comments

Comments
 (0)