Skip to content

Commit 41cf865

Browse files
Version 4.2.0
- Added Custom Domain option - Added more fields to LoginRadiusUltimateUserProfile model - Auth Delete Account API (GET) - Access Token API (GET) - Status Posting API (GET) - Phone Login API (POST) - MFA Email Login API (POST) - MFA User Name Login API (POST) - MFA Phone Login API (POST) - Update MFA by Access Token (PUT) - Update MFA Setting (PUT) - Access Token via Vkontakte Token API (GET) - Access Token via Google JWT API (GET) - WebHook Subscribe API (POST) - WebHook Test API (GET) - WebHook Subscribed URLs API (GET) - WebHook Unsubscribe API (DEL) - Delete All Records by Datasource API (DEL)
1 parent d8c72c7 commit 41cf865

File tree

88 files changed

+1971
-4355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1971
-4355
lines changed

CHANGELOG.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
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://github.com/LoginRadius/java-sdk)
22
3+
### Version 4.2.0
4+
Released on **October 11, 2018**
5+
##### Enhancements
6+
7+
- Added Custom Domain option
8+
- Added more fields to LoginRadiusUltimateUserProfile model
9+
- Auth Delete Account API (GET)
10+
- Access Token API (GET)
11+
- Status Posting API (GET)
12+
- Phone Login API (POST)
13+
- MFA Email Login API (POST)
14+
- MFA User Name Login API (POST)
15+
- MFA Phone Login API (POST)
16+
- Update MFA by Access Token (PUT)
17+
- Update MFA Setting (PUT)
18+
- Access Token via Vkontakte Token API (GET)
19+
- Access Token via Google JWT API (GET)
20+
- WebHook Subscribe API (POST)
21+
- WebHook Test API (GET)
22+
- WebHook Subscribed URLs API (GET)
23+
- WebHook Unsubscribe API (DEL)
24+
- Delete All Records by Datasource API (DEL)
25+
26+
##### Breaking Changes
27+
28+
- Renamed LoginRadiusConstant variables with 2FA to MFA
29+
30+
331
### Version 4.1.0
432
Released on **September 20, 2018**
533

634
##### Enhancements
735

8-
- Added API Request Signing(Enabling this feature customer don’t need to pass API secret in API request. They can pass a dynamically generated hash value instead of this. Also, this feature will make sure that the message has not tampered during transit when someone calls our APIs).
9-
- Add Request Access Token in Header(LoginRadius access token can be passed on to the request as in header for authentication APIs).
36+
- Added API Request Signing(Enabling this feature customer don’t need to pass apisecret in API request. They can pass a dynamically generated hash value instead of this. Also, this feature will make sure that the message has not tampered during transit when someone calls our APIs).
37+
- Add Request Access Token in Header(LoginRadius access token can be passed on to the request as in header for auth apis).
1038
- Option to Prevent Sending Email Verification(an option to prevent sending email verification in case of optional email verification flow).
1139
- Recaptcha for Auth APIs(By enabling this option customer can enforce client to pass reCaptcha in some auth APIs for authentication).
1240
- Access Token on Registration Event.
@@ -32,10 +60,19 @@ Released on **September 20, 2018**
3260

3361
##### Breaking Changes
3462

35-
- Updated endpoints and renamed "Auto Login" to "Smart Login", "No Registration/Simplified Registration" to "One touch Login" and "Instant Link Login" to "PasswordLess Login". Also, changed the methods of the above APIs accordingly.
36-
- Defined new Method by using it you can directly initialize your API key and secret key.you don't have to initialize in every method.
37-
- For more details, please have a look [here](https://docs.loginradius.com/api/v2/deployment/sdk-libraries/java-library)
63+
- For developers migrating from v4.0.1, there will be some breaking changes in terms of SDK implementation. In this version, we have updated endpoints and renamed "Auto Login" to "Smart Login", "No Registration/Simplified Registration" to "One touch Login" and "Instant Link Login" to "PasswordLess Login". Also, changed the methods of the above APIs accordingly.
64+
- We define new Method by using it you can directly initilize your api key and secret key.you dont have to initilize in every method.
65+
- For more details, please have a look [here](https://docs.loginradius.com/api/v2/deployment/sdk-libraries/java-library)
66+
67+
68+
69+
70+
### Version 4.0.1
71+
Released on **December 28, 2017**
72+
73+
##### Enhancements
3874

75+
- Updated endpoint of Configuration API.
3976

4077
### Version 4.0.0
4178
Released on **November 17, 2017**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Use the following dependency in your project:
2727
<dependency>
2828
<groupId>com.loginradius.sdk</groupId>
2929
<artifactId>java-sdk</artifactId>
30-
<version>4.1.0</version>
30+
<version>4.2.0</version>
3131
</dependency>
3232
3333
```

demo/LoginRadiusJavaDemo/WebContent/Profile.jsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
Gson gson =new Gson();
7070
if(token !=null)
7171
{
72-
session.setAttribute("lrtoken",token);
72+
session.setAttribute("lrtoken",token.getAccessToken());
7373
7474
7575
@@ -94,7 +94,7 @@
9494
<tr>
9595

9696
<td style="padding: 10px; border: none; width: 25%;"><img
97-
src="<%=profile.ImageUrl%>" alt="Avatar"
97+
src="<%=profile.getImageUrl()%>" alt="Avatar"
9898
style="width: 140px; height: 140px;"></td>
9999

100100
<td

demo/LoginRadiusJavaDemo/WebContent/assets/js/LoginRadiusLoginScreen.1.0.0.js

Lines changed: 114 additions & 54 deletions
Large diffs are not rendered by default.

demo/LoginRadiusJavaDemo/bin/WebContent/Profile.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
5959
if(token !=null)
6060
{
61-
session.setAttribute("lrtoken",token.access_token);
61+
session.setAttribute("lrtoken",token.getAccessToken());
6262
try{
6363
Map<String, String> params = new HashMap<String,String>();
6464
params.put("emailTemplate","sdfsdfds");

sdk/LoginRadius-JavaSDK/pom.xml

Lines changed: 11 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>4.1.0</version>
9+
<version>4.2.0</version>
1010
<description>LoginRadius java SDK contains registration and social APIs</description>
1111
<url>https://github.com/LoginRadius/java-sdk</url>
1212

@@ -49,6 +49,15 @@
4949
<version>2.5</version>
5050
</dependency>
5151

52+
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
53+
<dependency>
54+
<groupId>commons-codec</groupId>
55+
<artifactId>commons-codec</artifactId>
56+
<version>1.9</version>
57+
</dependency>
58+
59+
60+
5261
</dependencies>
5362

5463
<distributionManagement>
@@ -126,4 +135,4 @@
126135
</build>
127136

128137

129-
</project>
138+
</project>

sdk/LoginRadius-JavaSDK/src/main/java/com/loginradius/sdk/advanced/api/AdvancedGetAPI.java

Lines changed: 10 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -4,125 +4,34 @@
44
/*
55
*
66
* Created by LoginRadius Development Team on 02/06/2017
7-
Copyright © 2017 LoginRadius Inc. All rights reserved.
7+
Copyright 2017 LoginRadius Inc. All rights reserved.
88
99
*/
1010

1111
import java.util.HashMap;
1212
import java.util.Map;
1313

14-
import com.loginradius.sdk.resource.Endpoint;
14+
import com.loginradius.sdk.resource.EndpointContent;
1515
import com.loginradius.sdk.resource.LoginRadiusException;
16-
import com.loginradius.sdk.util.ArgumentValidator;
17-
import com.loginradius.sdk.util.LoginRadiusSDK;
1816

1917
public class AdvancedGetAPI extends LRAdvancedAPI {
20-
2118
private String method = "";
22-
private String finalpath = "";
23-
2419
private Map<String, String> map = new HashMap<String, String>();
2520

2621
public AdvancedGetAPI(String method, Map<String, String> map) {
27-
2822
this.method = method;
29-
3023
this.map = map;
31-
3224
}
3325

26+
@Override
3427
public String getResponse(String token) {
35-
36-
// ARgument validator should go here.
37-
38-
if (!ArgumentValidator.pathValidator(this.method)) {
39-
40-
throw new LoginRadiusException(
41-
"Invalid Argument used. Please refer documentation and use the correct argument");
42-
43-
}
44-
45-
Map<String, String> params = new HashMap<String, String>();
46-
if (this.map != null && !this.map.isEmpty()) {
47-
params.putAll(map);
48-
28+
EndpointContent api = getApi(method);
29+
if (api == null) {
30+
throw new LoginRadiusException("Invalid Argument used. Please refer documentation and use the correct argument");
4931
}
32+
Map<String, String> params = getParams(api, map, token);
33+
String finalPath = getFinalPath(api.getPath(), map);
5034

51-
if ("tokenvalidate".equals(method)) {
52-
if(!map.containsKey("key")){
53-
params.put("key", LoginRadiusSDK.getApiKey());
54-
params.put("secret", LoginRadiusSDK.getApiSecret());
55-
}
56-
params.put("access_token", token);
57-
finalpath = Endpoint.getExchangetoken() + "/Validate";
58-
} else if ("tokeninvalidate".equals(method)) {
59-
if(!map.containsKey("key")){
60-
params.put("key", LoginRadiusSDK.getApiKey());
61-
params.put("secret", LoginRadiusSDK.getApiSecret());
62-
}
63-
params.put("access_token", token);
64-
finalpath = Endpoint.getExchangetoken() + "/invalidate";
65-
} else if ("testresthookssettings".equals(method)) {
66-
if(!map.containsKey("api_key")){
67-
params.put("api_key", LoginRadiusSDK.getApiKey());
68-
params.put("api_secret", LoginRadiusSDK.getApiSecret());
69-
}
70-
finalpath = Endpoint.getV2_AdvancedRestHooksSettings();
71-
} else if ("listofresthooks".equals(method)) {
72-
if(!map.containsKey("api_key")){
73-
params.put("api_key", LoginRadiusSDK.getApiKey());
74-
params.put("api_secret", LoginRadiusSDK.getApiSecret());
75-
}
76-
finalpath = Endpoint.getV2_AdvancedListofRestHooks();
77-
} else if ("getsubscribedurl".equals(method)) {
78-
if(!map.containsKey("api_key")){
79-
params.put("api_key", LoginRadiusSDK.getApiKey());
80-
params.put("api_secret", LoginRadiusSDK.getApiSecret());
81-
}
82-
finalpath = Endpoint.getV2_AdvancedGetSubscribedurl();
83-
} else if ("accesstokenviafbtoken".equals(method)) {
84-
if(!map.containsKey("key")){
85-
params.put("key", LoginRadiusSDK.getApiKey());
86-
}
87-
finalpath = Endpoint.getV2_AdvancedAccessTokenViaSocialToken() + "facebook";
88-
} else if ("accesstokenviatwtoken".equals(method)) {
89-
if(!map.containsKey("key")){
90-
params.put("key", LoginRadiusSDK.getApiKey());
91-
}
92-
finalpath = Endpoint.getV2_AdvancedAccessTokenViaSocialToken() + "twitter";
93-
} else if ("refreshprofile".equals(method)) {
94-
params.put("access_token", token);
95-
finalpath = Endpoint.getV2_AdvancedRefreshUserProfile();
96-
} else if ("refreshtoken".equals(method)) {
97-
if(!map.containsKey("secret")){
98-
params.put("secret", LoginRadiusSDK.getApiSecret());
99-
}
100-
params.put("access_token", token);
101-
finalpath = Endpoint.getV2_AdvancedRefreshToken();
102-
} else if ("shortenURL".equals(method)) {
103-
if(!map.containsKey("key")){
104-
params.put("key", LoginRadiusSDK.getApiKey());
105-
}
106-
finalpath = Endpoint.getV2_AdvancedShortenURL();
107-
} else if ("trackablestatusfetching".equals(method)) {
108-
if(!map.containsKey("secret")){
109-
params.put("secret", LoginRadiusSDK.getApiSecret());
110-
}
111-
finalpath = Endpoint.getV2_STATUS() + "/trackable";
112-
} else if ("gettrackablestatusstats".equals(method)) {
113-
params.put("access_token", token);
114-
finalpath = Endpoint.getV2_STATUS() + "/trackable/js";
115-
}else if ("getactivesession".equals(method)) {
116-
if(!map.containsKey("key")){
117-
params.put("key", LoginRadiusSDK.getApiKey());
118-
params.put("secret", LoginRadiusSDK.getApiSecret());
119-
}
120-
params.put("token", token);
121-
finalpath = Endpoint.getV2_AdvancedAccessTokenViaSocialToken() + "activesession";
122-
}
123-
124-
return executeGet(finalpath, params);
125-
35+
return executeGet(finalPath, params);
12636
}
127-
128-
}
37+
}

sdk/LoginRadius-JavaSDK/src/main/java/com/loginradius/sdk/advanced/api/AdvancedPostAPI.java

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,44 @@
44
/*
55
*
66
* Created by LoginRadius Development Team on 02/06/2017
7-
Copyright © 2017 LoginRadius Inc. All rights reserved.
7+
Copyright 2017 LoginRadius Inc. All rights reserved.
88
99
*/
1010

1111
import java.util.HashMap;
1212
import java.util.Map;
1313

1414
import com.google.gson.JsonObject;
15-
import com.loginradius.sdk.resource.Endpoint;
15+
import com.loginradius.sdk.resource.EndpointContent;
1616
import com.loginradius.sdk.resource.LoginRadiusException;
17-
import com.loginradius.sdk.util.ArgumentValidator;
18-
import com.loginradius.sdk.util.LoginRadiusSDK;
1917

2018
public class AdvancedPostAPI extends LRAdvancedAPI {
21-
2219
private final String method;
23-
24-
private String finalpath = "";
25-
2620
private Map<String, String> map = new HashMap<String, String>();
27-
2821
private JsonObject json;
2922

3023
public AdvancedPostAPI(String method, Map<String, String> map, JsonObject data) {
31-
3224
this.method = method;
33-
3425
this.map = map;
26+
3527
if (data != null) {
3628
this.json = data;
3729
} else {
3830
JsonObject registerdata = new JsonObject();
3931
registerdata.addProperty("", "");
4032
this.json = registerdata;
4133
}
42-
4334
}
4435

4536
@Override
4637
public String getResponse(String token) {
47-
// TODO Auto-generated method stub
48-
49-
// write the validator
50-
51-
if (!ArgumentValidator.pathValidator(this.method)) {
52-
53-
throw new LoginRadiusException(
54-
"Invalid Argument used. Please refer documentation and use the correct argument");
55-
56-
}
57-
58-
Map<String, String> params = new HashMap<String, String>();
59-
if (this.map != null && !this.map.isEmpty()) {
60-
params.putAll(map);
61-
62-
}
63-
64-
65-
if ("getsocialidentity".equals(method)) {
66-
if(!map.containsKey("key")){
67-
params.put("key", LoginRadiusSDK.getApiKey());
68-
params.put("secret", LoginRadiusSDK.getApiSecret());
69-
}
70-
finalpath = Endpoint.getV2_AdvancedIdentity();
71-
} else if ("querydata".equals(method)) {
72-
if(!map.containsKey("apikey")){
73-
params.put("apikey", LoginRadiusSDK.getApiKey());
74-
params.put("apisecret", LoginRadiusSDK.getApiSecret());
75-
}
76-
finalpath = Endpoint.getV2_AdvancedQueryData();
77-
} else if ("subscriberesthooks".equals(method)) {
78-
if(!map.containsKey("api_key")){
79-
params.put("api_key", LoginRadiusSDK.getApiKey());
80-
params.put("api_secret", LoginRadiusSDK.getApiSecret());
81-
}
82-
finalpath = Endpoint.getV2_AdvancedSubscribeRestHooks();
83-
} else if ("unsubscriberesthooks".equals(method)) {
84-
if(!map.containsKey("api_key")){
85-
params.put("api_key", LoginRadiusSDK.getApiKey());
86-
params.put("api_secret", LoginRadiusSDK.getApiSecret());
87-
}
88-
finalpath = Endpoint.getV2_AdvancedUnsubscribeRestHooks();
89-
}else if ("trackablestatusposting".equals(method)) {
90-
params.put("access_token", token);
91-
finalpath = Endpoint.getV2_STATUS() + "/trackable";
38+
EndpointContent api = getApi(method);
39+
if (api == null) {
40+
throw new LoginRadiusException("Invalid Argument used. Please refer documentation and use the correct argument");
9241
}
42+
Map<String, String> params = getParams(api, map, token);
43+
String finalPath = getFinalPath(api.getPath(), map);
9344

94-
return executePost(finalpath, params, json);
45+
return executePost(finalPath, params, json);
9546
}
96-
97-
}
47+
}

0 commit comments

Comments
 (0)