Skip to content

Commit

Permalink
Release Version 11.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
indrasen715 committed Sep 7, 2021
1 parent 0c32829 commit d523edc
Show file tree
Hide file tree
Showing 24 changed files with 1,733 additions and 133 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
> **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/)
# Version 11.2.0
Release on September 7, 2021

## Enhancements

- Updated Jquery with latest version(3.6.0) in SDK Demo


## Added new multiple APIs for better user experience

- MFAEmailOtpByAccessToken
- MFAValidateEmailOtpByAccessToken
- MFAResetEmailOtpAuthenticatorByAccessToken
- MFASecurityQuestionAnswerByAccessToken
- MFAResetSecurityQuestionAuthenticatorByAccessToken
- MFAEmailOTP
- MFAValidateEmailOtp
- MFASecurityQuestionAnswer
- MFASecurityQuestionAnswerVerification
- MFAResetEmailOtpAuthenticatorByUid
- MFAResetSecurityQuestionAuthenticatorByUid
- ReAuthValidateEmailOtp
- ReAuthSendEmailOtp
- ReAuthBySecurityQuestion

#### Added `EmailTemplate2FA` parameter in the following API
- MFALoginByEmail
- MFALoginByUserName
- MFALoginByPhone

#### Added `RbaBrowserEmailTemplate`, `RbaCityEmailTemplate` ,`RbaCountryEmailTemplate` , `RbaIpEmailTemplate` parameter in the following API
- MFAValidateOTPByPhone
- MFAValidateGoogleAuthCode
- MFAValidateBackupCode

#### Added `emailTemplate`, `verificationUrl` ,`welcomeEmailTemplate` parameter in the following API

- GetProfileByAccessToken

#### Removed `smsTemplate2FA ` parameter from the following API
- mfaValidateGoogleAuthCode

# Version 11.1.0
Release on April 21, 2021

Expand Down
2 changes: 1 addition & 1 deletion LoginRadius-JavaSDK/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.loginradius.sdk</groupId>
<artifactId>java-sdk</artifactId>
<version>11.1.0</version>
<version>11.2.0</version>
<name>LoginRadius-CustomerIdentity-JavaSDK</name>
<description>LoginRadius Java SDK</description>
<url>https://github.com/LoginRadius/java-sdk</url>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
import com.loginradius.sdk.models.requestmodels.PINAuthEventBasedAuthModelWithLockout;
import com.loginradius.sdk.models.requestmodels.PasswordEventBasedAuthModelWithLockout;
import com.loginradius.sdk.models.requestmodels.ReauthByBackupCodeModel;
import com.loginradius.sdk.models.requestmodels.ReauthByEmailOtpModel;
import com.loginradius.sdk.models.requestmodels.ReauthByGoogleAuthenticatorCodeModel;
import com.loginradius.sdk.models.requestmodels.ReauthByOtpModel;
import com.loginradius.sdk.models.requestmodels.SecurityQuestionAnswerUpdateModel;
import com.loginradius.sdk.models.responsemodels.EventBasedMultiFactorAuthenticationToken;
import com.loginradius.sdk.models.responsemodels.MultiFactorAuthenticationSettingsResponse;
import com.loginradius.sdk.models.responsemodels.otherobjects.PostResponse;
import com.loginradius.sdk.models.responsemodels.otherobjects.PostValidationResponse;
import com.loginradius.sdk.util.AsyncHandler;
import com.loginradius.sdk.util.ErrorResponse;
Expand Down Expand Up @@ -419,4 +422,134 @@ public void onFailure(ErrorResponse errorResponse) {
}
});
}

// <summary>
// This API is used to validate the triggered MFA authentication flow with an Email OTP.
// </summary>
// <param name="accessToken">Uniquely generated identifier key by LoginRadius that is activated after successful authentication.</param>
// <param name="reauthByEmailOtpModel">payload</param>
// <returns>Response containing Definition response of MFA reauthentication</returns>
// 42.14


public void reAuthValidateEmailOtp(String accessToken, ReauthByEmailOtpModel reauthByEmailOtpModel, final AsyncHandler<EventBasedMultiFactorAuthenticationToken> handler) {

if (LoginRadiusValidator.isNullOrWhiteSpace(accessToken)) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("accessToken"));
}

if (reauthByEmailOtpModel == null) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("reauthByEmailOtpModel"));
}

Map<String, String> queryParameters = new HashMap<String, String>();
queryParameters.put("access_token", accessToken);
queryParameters.put("apiKey", LoginRadiusSDK.getApiKey());

String resourcePath = "identity/v2/auth/account/reauth/2fa/otp/email/verify";

LoginRadiusRequest.execute("PUT", resourcePath, queryParameters, gson.toJson(reauthByEmailOtpModel), new AsyncHandler<String>() {

@Override
public void onSuccess(String response) {
TypeToken<EventBasedMultiFactorAuthenticationToken> typeToken = new TypeToken<EventBasedMultiFactorAuthenticationToken>() {};
EventBasedMultiFactorAuthenticationToken successResponse = JsonDeserializer.deserializeJson(response,typeToken);
handler.onSuccess(successResponse);
}

@Override
public void onFailure(ErrorResponse errorResponse) {
handler.onFailure(errorResponse);
}
});
}

// <summary>
// This API is used to send the MFA Email OTP to the email for Re-authentication
// </summary>
// <param name="accessToken">Uniquely generated identifier key by LoginRadius that is activated after successful authentication.</param>
// <param name="emailId">EmailId</param>
// <param name="emailTemplate2FA">EmailTemplate2FA</param>
// <returns>Response containing Definition of Complete Validation data</returns>
// 42.15


public void reAuthSendEmailOtp(String accessToken, String emailId,
String emailTemplate2FA, final AsyncHandler<PostResponse> handler) {

if (LoginRadiusValidator.isNullOrWhiteSpace(accessToken)) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("accessToken"));
}

if (LoginRadiusValidator.isNullOrWhiteSpace(emailId)) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("emailId"));
}

Map<String, String> queryParameters = new HashMap<String, String>();
queryParameters.put("access_token", accessToken);
queryParameters.put("apiKey", LoginRadiusSDK.getApiKey());
queryParameters.put("emailId", emailId);

if (!LoginRadiusValidator.isNullOrWhiteSpace(emailTemplate2FA)) {
queryParameters.put("emailTemplate2FA", emailTemplate2FA);
}

String resourcePath = "identity/v2/auth/account/reauth/2fa/otp/email";

LoginRadiusRequest.execute("GET", resourcePath, queryParameters, null, new AsyncHandler<String>() {

@Override
public void onSuccess(String response) {
TypeToken<PostResponse> typeToken = new TypeToken<PostResponse>() {};
PostResponse successResponse = JsonDeserializer.deserializeJson(response,typeToken);
handler.onSuccess(successResponse);
}

@Override
public void onFailure(ErrorResponse errorResponse) {
handler.onFailure(errorResponse);
}
});
}

// <summary>
// This API is used to validate the triggered MFA re-authentication flow with security questions answers.
// </summary>
// <param name="accessToken">Uniquely generated identifier key by LoginRadius that is activated after successful authentication.</param>
// <param name="securityQuestionAnswerUpdateModel">payload</param>
// <returns>Response containing Definition response of MFA reauthentication</returns>
// 42.16


public void reAuthBySecurityQuestion(String accessToken, SecurityQuestionAnswerUpdateModel securityQuestionAnswerUpdateModel, final AsyncHandler<EventBasedMultiFactorAuthenticationToken> handler) {

if (LoginRadiusValidator.isNullOrWhiteSpace(accessToken)) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("accessToken"));
}

if (securityQuestionAnswerUpdateModel == null) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("securityQuestionAnswerUpdateModel"));
}

Map<String, String> queryParameters = new HashMap<String, String>();
queryParameters.put("access_token", accessToken);
queryParameters.put("apiKey", LoginRadiusSDK.getApiKey());

String resourcePath = "identity/v2/auth/account/reauth/2fa/securityquestionanswer/verify";

LoginRadiusRequest.execute("POST", resourcePath, queryParameters, gson.toJson(securityQuestionAnswerUpdateModel), new AsyncHandler<String>() {

@Override
public void onSuccess(String response) {
TypeToken<EventBasedMultiFactorAuthenticationToken> typeToken = new TypeToken<EventBasedMultiFactorAuthenticationToken>() {};
EventBasedMultiFactorAuthenticationToken successResponse = JsonDeserializer.deserializeJson(response,typeToken);
handler.onSuccess(successResponse);
}

@Override
public void onFailure(ErrorResponse errorResponse) {
handler.onFailure(errorResponse);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import com.loginradius.sdk.util.LoginRadiusSDK;



public class AuthenticationApi {
private static Gson gson =new Gson();

Expand Down Expand Up @@ -392,11 +391,14 @@ public void onFailure(ErrorResponse errorResponse) {
// </summary>
// <param name="accessToken">Uniquely generated identifier key by LoginRadius that is activated after successful authentication.</param>
// <param name="fields">The fields parameter filters the API response so that the response only includes a specific set of fields</param>
// <param name="emailTemplate"></param>
// <param name="verificationUrl"></param>
// <param name="welcomeEmailTemplate"></param>
// <returns>Response containing Definition for Complete profile data</returns>
// 5.2


public void getProfileByAccessToken(String accessToken, String fields, final AsyncHandler<Identity> handler) {
public void getProfileByAccessToken(String accessToken, String fields, String emailTemplate,String verificationUrl, String welcomeEmailTemplate, final AsyncHandler<Identity> handler) {

if (LoginRadiusValidator.isNullOrWhiteSpace(accessToken)) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("accessToken"));
Expand All @@ -410,6 +412,18 @@ public void getProfileByAccessToken(String accessToken, String fields, final Asy
queryParameters.put("fields", fields);
}

if (!LoginRadiusValidator.isNullOrWhiteSpace(emailTemplate)) {
queryParameters.put("emailTemplate", emailTemplate);
}

if (!LoginRadiusValidator.isNullOrWhiteSpace(verificationUrl)) {
queryParameters.put("verificationUrl", verificationUrl);
}

if (!LoginRadiusValidator.isNullOrWhiteSpace(welcomeEmailTemplate)) {
queryParameters.put("welcomeEmailTemplate", welcomeEmailTemplate);
}

String resourcePath = "identity/v2/auth/account";

LoginRadiusRequest.execute("GET", resourcePath, queryParameters, null, new AsyncHandler<String>() {
Expand Down Expand Up @@ -656,13 +670,13 @@ public void onFailure(ErrorResponse errorResponse) {
}

// <summary>
//
// This API is used to get a user's profile using the clientGuid parameter if no callback feature enabled
// </summary>
// <param name="clientGuid"></param>
// <param name="emailTemplate"></param>
// <param name="fields"></param>
// <param name="verificationUrl"></param>
// <param name="welcomeEmailTemplate"></param>
// <param name="clientGuid">ClientGuid</param>
// <param name="emailTemplate">EmailTemplate</param>
// <param name="fields">Fields</param>
// <param name="verificationUrl">VerificationUrl</param>
// <param name="welcomeEmailTemplate">WelcomeEmailTemplate</param>
// <returns>Response containing User Profile Data and access token</returns>
// 5.16

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ public void onFailure(ErrorResponse errorResponse) {
}

// <summary>
//
// This API is used to verify the otp sent to the email when doing a passwordless login.
// </summary>
// <param name="passwordLessLoginByEmailAndOtpModel"></param>
// <param name="fields"></param>
// <param name="passwordLessLoginByEmailAndOtpModel">payload</param>
// <param name="fields">Fields</param>
// <returns>Response containing User Profile Data and access token</returns>
// 9.23

Expand Down Expand Up @@ -301,10 +301,10 @@ public void onFailure(ErrorResponse errorResponse) {
}

// <summary>
//
// This API is used to verify the otp sent to the email when doing a passwordless login.
// </summary>
// <param name="passwordLessLoginByUserNameAndOtpModel"></param>
// <param name="fields"></param>
// <param name="passwordLessLoginByUserNameAndOtpModel">payload</param>
// <param name="fields">Fields</param>
// <returns>Response containing User Profile Data and access token</returns>
// 9.24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1324,46 +1324,6 @@ public void onFailure(ErrorResponse errorResponse) {
});
}

// <summary>
// The User Profile API is used to get social profile data from the user's social account after authentication.<br><br><b>Supported Providers:</b> All
// </summary>
// <param name="accessToken">Uniquely generated identifier key by LoginRadius that is activated after successful authentication.</param>
// <param name="fields">The fields parameter filters the API response so that the response only includes a specific set of fields</param>
// <returns>Response containing Definition for Complete UserProfile data</returns>
// 38.1


public void getSocialUserProfile(String accessToken, String fields, final AsyncHandler<UserProfile> handler) {

if (LoginRadiusValidator.isNullOrWhiteSpace(accessToken)) {
throw new IllegalArgumentException(LoginRadiusValidator.getValidationMessage("accessToken"));
}

Map<String, String> queryParameters = new HashMap<String, String>();
queryParameters.put("access_token", accessToken);

if (!LoginRadiusValidator.isNullOrWhiteSpace(fields)) {
queryParameters.put("fields", fields);
}

String resourcePath = "api/v2/userprofile";

LoginRadiusRequest.execute("GET", resourcePath, queryParameters, null, new AsyncHandler<String>() {

@Override
public void onSuccess(String response) {
TypeToken<UserProfile> typeToken = new TypeToken<UserProfile>() {};
UserProfile successResponse = JsonDeserializer.deserializeJson(response,typeToken);
handler.onSuccess(successResponse);
}

@Override
public void onFailure(ErrorResponse errorResponse) {
handler.onFailure(errorResponse);
}
});
}

// <summary>
// The User Profile API is used to get the latest updated social profile data from the user's social account after authentication. The social profile will be retrieved via oAuth and OpenID protocols. The data is normalized into LoginRadius' standard data format. This API should be called using the access token retrieved from the refresh access token API.
// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
Expand All @@ -23,10 +27,6 @@
import java.util.Map;
import java.util.TimeZone;
import java.util.zip.GZIPInputStream;
import java.net.Proxy;
import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
Expand Down
Loading

0 comments on commit d523edc

Please sign in to comment.