Unverified Commit 8ce68906 authored by AMIT KUMAR's avatar AMIT KUMAR Committed by GitHub
Browse files

Issue #SB-000 feat: added request context to HttpClientUtil class met… (#924)

* Issue #SB-000 feat: added request context to HttpClientUtil class methods
No related merge requests found
Showing with 116 additions and 174 deletions
+116 -174
......@@ -53,8 +53,8 @@ public class UserGetRequestValidator extends BaseRequestValidator {
public void validateGetUserByKeyRequestaWithCaptcha(Request request, Http.Request httpRequest) {
String captcha = httpRequest.getQueryString(JsonKey.CAPTCHA_RESPONSE);
logger.info("QueryString: " + httpRequest.uri());
logger.info("Captach: " + captcha);
logger.debug("QueryString: " + httpRequest.uri());
logger.debug("Captach: " + captcha);
String mobileApp = httpRequest.getQueryString(JsonKey.MOBILE_APP);
if (Boolean.parseBoolean(ProjectUtil.getConfigValue(JsonKey.ENABLE_CAPTCHA))
&& !new CaptchaHelper().validate(captcha, mobileApp)) {
......
......@@ -46,7 +46,7 @@ public class CaptchaHelper {
.toString();
logger.info("Calling Api: " + url);
logger.info("Captcha: " + captcha);
String response = HttpClientUtil.postFormData(url, requestMap, headers);
String response = HttpClientUtil.postFormData(url, requestMap, headers, null);
Map<String, Object> responseMap = mapper.readValue(response, Map.class);
isCaptchaValid = (boolean) responseMap.get("success");
if (!isCaptchaValid) {
......
......@@ -29,6 +29,7 @@ import org.sunbird.http.HttpClientUtil;
import org.sunbird.keys.JsonKey;
import org.sunbird.model.user.UserDeclareEntity;
import org.sunbird.request.HeaderParam;
import org.sunbird.request.RequestContext;
import org.sunbird.response.Response;
import org.sunbird.response.ResponseParams;
import org.sunbird.util.ProjectUtil;
......@@ -577,7 +578,7 @@ public class UserControllerTest extends BaseApplicationTest {
ObjectMapper objectMapper = new ObjectMapper();
String s = objectMapper.writeValueAsString(map);
when(ProjectUtil.getConfigValue(Mockito.anyString())).thenReturn("anyString");
when(HttpClientUtil.postFormData(Mockito.anyString(), Mockito.anyMap(), Mockito.anyMap()))
when(HttpClientUtil.postFormData(Mockito.anyString(), Mockito.anyMap(), Mockito.anyMap(),Mockito.any(RequestContext.class)))
.thenReturn(s);
Result result = performTest("/v2/user/exists/email/demo@gmail.com", "GET", null);
assertTrue(getResponseStatus(result) == 200);
......
......@@ -16,6 +16,7 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.sunbird.http.HttpClientUtil;
import org.sunbird.request.RequestContext;
import org.sunbird.util.ProjectUtil;
@RunWith(PowerMockRunner.class)
......@@ -54,7 +55,7 @@ public class CaptchaHelperTest {
ObjectMapper objectMapper = new ObjectMapper();
String s = objectMapper.writeValueAsString(map);
when(ProjectUtil.getConfigValue(Mockito.anyString())).thenReturn("anyString");
when(HttpClientUtil.postFormData(Mockito.anyString(), Mockito.anyMap(), Mockito.anyMap()))
when(HttpClientUtil.postFormData(Mockito.anyString(), Mockito.anyMap(), Mockito.anyMap(), Mockito.any()))
.thenReturn(s);
}
}
......@@ -75,7 +75,7 @@ public class NICGatewaySmsProvider implements ISmsProvider {
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Accept", "application/json");
String response = HttpClientUtil.get(URI.toString(), headers);
String response = HttpClientUtil.get(URI.toString(), headers, context);
if (StringUtils.isNotBlank(response)) {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> resultMap;
......
package org.sunbird.http;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -22,6 +23,7 @@ import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.sunbird.logging.LoggerUtil;
import org.sunbird.request.RequestContext;
public class HttpClientUtil {
private static LoggerUtil logger = new LoggerUtil(HttpClientUtil.class);
......@@ -68,7 +70,7 @@ public class HttpClientUtil {
return httpClientUtil;
}
public static String get(String requestURL, Map<String, String> headers) {
public static String get(String requestURL, Map<String, String> headers, RequestContext context) {
CloseableHttpResponse response = null;
try {
HttpGet httpGet = new HttpGet(requestURL);
......@@ -78,53 +80,16 @@ public class HttpClientUtil {
}
}
response = httpclient.execute(httpGet);
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity httpEntity = response.getEntity();
byte[] bytes = EntityUtils.toByteArray(httpEntity);
StatusLine sl = response.getStatusLine();
logger.debug(
"Response from get call : " + sl.getStatusCode() + " - " + sl.getReasonPhrase());
return new String(bytes);
} else {
getErrorResponse(response, "GET");
return "";
}
return getResponse(response, context, "GET");
} catch (Exception ex) {
logger.error("Exception occurred while calling get method", ex);
logger.error(context,"Exception occurred while calling get method", ex);
return "";
} finally {
if (null != response) {
try {
response.close();
} catch (Exception ex) {
logger.error("Exception occurred while closing get response object", ex);
}
}
}
}
private static void getErrorResponse(CloseableHttpResponse response, String method) {
try {
HttpEntity httpEntity = response.getEntity();
byte[] bytes = EntityUtils.toByteArray(httpEntity);
StatusLine sl = response.getStatusLine();
String resp = new String(bytes);
logger.info(
"Response from : "
+ method
+ " call "
+ resp
+ " status "
+ sl.getStatusCode()
+ " - "
+ sl.getReasonPhrase());
} catch (Exception ex) {
logger.error("Exception occurred while fetching response", ex);
closeResponse(response, context, "GET");
}
}
public static String post(String requestURL, String params, Map<String, String> headers) {
public static String post(String requestURL, String params, Map<String, String> headers, RequestContext context) {
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(requestURL);
......@@ -137,34 +102,17 @@ public class HttpClientUtil {
httpPost.setEntity(entity);
response = httpclient.execute(httpPost);
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity httpEntity = response.getEntity();
byte[] bytes = EntityUtils.toByteArray(httpEntity);
StatusLine sl = response.getStatusLine();
logger.debug(
"Response from post call : " + sl.getStatusCode() + " - " + sl.getReasonPhrase());
return new String(bytes);
} else {
getErrorResponse(response, "POST");
return "";
}
return getResponse(response, context, "POST");
} catch (Exception ex) {
logger.error("Exception occurred while calling Post method", ex);
logger.error(context,"Exception occurred while calling Post method", ex);
return "";
} finally {
if (null != response) {
try {
response.close();
} catch (Exception ex) {
logger.error("Exception occurred while closing Post response object", ex);
}
}
closeResponse(response, context, "POST");
}
}
public static String postFormData(
String requestURL, Map<String, String> params, Map<String, String> headers) {
String requestURL, Map<String, String> params, Map<String, String> headers, RequestContext context) {
CloseableHttpResponse response = null;
try {
HttpPost httpPost = new HttpPost(requestURL);
......@@ -183,33 +131,16 @@ public class HttpClientUtil {
httpPost.setEntity(entity);
response = httpclient.execute(httpPost);
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity httpEntity = response.getEntity();
byte[] bytes = EntityUtils.toByteArray(httpEntity);
StatusLine sl = response.getStatusLine();
logger.debug(
"Response from post call : " + sl.getStatusCode() + " - " + sl.getReasonPhrase());
return new String(bytes);
} else {
getErrorResponse(response, "POST FORM DATA");
return "";
}
return getResponse(response, context, "postFormData");
} catch (Exception ex) {
logger.error("Exception occurred while calling Post method", ex);
logger.error(context,"Exception occurred while calling postFormData method", ex);
return "";
} finally {
if (null != response) {
try {
response.close();
} catch (Exception ex) {
logger.error("Exception occurred while closing Post response object", ex);
}
}
closeResponse(response, context, "postFormData");
}
}
public static String patch(String requestURL, String params, Map<String, String> headers) {
public static String patch(String requestURL, String params, Map<String, String> headers, RequestContext context) {
CloseableHttpResponse response = null;
try {
HttpPatch httpPatch = new HttpPatch(requestURL);
......@@ -222,35 +153,16 @@ public class HttpClientUtil {
httpPatch.setEntity(entity);
response = httpclient.execute(httpPatch);
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity httpEntity = response.getEntity();
byte[] bytes = EntityUtils.toByteArray(httpEntity);
StatusLine sl = response.getStatusLine();
logger.debug(
"Response from patch call : " + sl.getStatusCode() + " - " + sl.getReasonPhrase());
String resp = new String(bytes);
logger.info("Got response from patch call : " + resp);
return resp;
} else {
getErrorResponse(response, "PATCH");
return "";
}
return getResponse(response, context, "PATCH");
} catch (Exception ex) {
logger.error("Exception occurred while calling patch method", ex);
logger.error(context,"Exception occurred while calling patch method", ex);
return "";
} finally {
if (null != response) {
try {
response.close();
} catch (Exception ex) {
logger.error("Exception occurred while closing patch response object", ex);
}
}
closeResponse(response, context, "PATCH");
}
}
public static String delete(String requestURL, Map<String, String> headers) {
public static String delete(String requestURL, Map<String, String> headers, RequestContext context) {
CloseableHttpResponse response = null;
try {
HttpDelete httpDelete = new HttpDelete(requestURL);
......@@ -260,32 +172,63 @@ public class HttpClientUtil {
}
}
response = httpclient.execute(httpDelete);
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity httpEntity = response.getEntity();
StatusLine sl = response.getStatusLine();
logger.debug(
"Response from delete call : " + sl.getStatusCode() + " - " + sl.getReasonPhrase());
if (null != httpEntity) {
byte[] bytes = EntityUtils.toByteArray(httpEntity);
return new String(bytes);
} else {
return "";
}
return getResponse(response, context, "DELETE");
} catch (Exception ex) {
logger.error(context,"Exception occurred while calling delete method", ex);
return "";
} finally {
closeResponse(response, context, "DELETE");
}
}
private static String getResponse(CloseableHttpResponse response, RequestContext context, String method) throws IOException {
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
HttpEntity httpEntity = response.getEntity();
StatusLine sl = response.getStatusLine();
logger.debug(context,
"Response from "+method+" call : " + sl.getStatusCode() + " - " + sl.getReasonPhrase());
if (null != httpEntity) {
byte[] bytes = EntityUtils.toByteArray(httpEntity);
String resp = new String(bytes);
logger.info(context,"Got response from "+method+" call : " + resp);
return resp;
} else {
getErrorResponse(response, "DELETE");
return "";
}
} catch (Exception ex) {
logger.error("Exception occurred while calling delete method", ex);
} else {
getErrorResponse(response, method, context);
return "";
} finally {
if (null != response) {
try {
response.close();
} catch (Exception ex) {
logger.error("Exception occurred while closing delete response object", ex);
}
}
}
private static void getErrorResponse(CloseableHttpResponse response, String method, RequestContext context) {
try {
HttpEntity httpEntity = response.getEntity();
byte[] bytes = EntityUtils.toByteArray(httpEntity);
StatusLine sl = response.getStatusLine();
String resp = new String(bytes);
logger.info(context,
"Response from : "
+ method
+ " call "
+ resp
+ " status "
+ sl.getStatusCode()
+ " - "
+ sl.getReasonPhrase());
} catch (Exception ex) {
logger.error(context, "Exception occurred while fetching response for method "+method, ex);
}
}
private static void closeResponse(CloseableHttpResponse response, RequestContext context, String method) {
if (null != response) {
try {
response.close();
} catch (Exception ex) {
logger.error(context,"Exception occurred while closing "+method+" response object", ex);
}
}
}
......
......@@ -33,7 +33,7 @@ public class KeycloakBruteForceAttackUtil {
+ "/attack-detection/brute-force/users/"
+ fedUserPrefix
+ userId;
String response = HttpClientUtil.get(url, getHeaders(context));
String response = HttpClientUtil.get(url, getHeaders(context), context);
logger.info(context, "KeycloakBruteForceAttackUtil:getUserStatus: Response = " + response);
Map<String, Object> attackStatus = new ObjectMapper().readValue(response, Map.class);
boolean isDisabled = ((boolean) attackStatus.get("disabled"));
......@@ -57,7 +57,7 @@ public class KeycloakBruteForceAttackUtil {
+ "/attack-detection/brute-force/users/"
+ fedUserPrefix
+ userId;
HttpClientUtil.delete(url, getHeaders(context));
HttpClientUtil.delete(url, getHeaders(context), context);
logger.info(context, "clear Brute Force For User for userId : " + userId);
return true;
}
......
......@@ -94,7 +94,7 @@ public class KeycloakRequiredActionLinkUtil {
+ "realms/"
+ ProjectUtil.getConfigValue(JsonKey.SUNBIRD_SSO_RELAM)
+ SUNBIRD_KEYCLOAK_REQD_ACTION_LINK;
String response = HttpClientUtil.post(url, mapper.writeValueAsString(request), headers);
String response = HttpClientUtil.post(url, mapper.writeValueAsString(request), headers, context);
logger.info(context, "KeycloakRequiredActionLinkUtil:generateLink: Response = " + response);
......
......@@ -24,7 +24,7 @@ public class KeycloakUtil {
fields.put("client_secret", ProjectUtil.getConfigValue(JsonKey.SUNBIRD_SSO_CLIENT_SECRET));
fields.put("grant_type", "client_credentials");
String response = HttpClientUtil.postFormData(url, fields, headers);
String response = HttpClientUtil.postFormData(url, fields, headers, context);
logger.debug(context, "KeycloakUtil:getAdminAccessToken: Response = " + response);
Map<String, Object> responseMap = new ObjectMapper().readValue(response, Map.class);
return (String) responseMap.get("access_token");
......
package org.sunbird.url;
import org.sunbird.request.RequestContext;
public interface URLShortner {
public String shortUrl(String url);
public String shortUrl(String url, RequestContext context);
}
......@@ -8,6 +8,7 @@ import org.apache.commons.lang3.StringUtils;
import org.sunbird.http.HttpClientUtil;
import org.sunbird.keys.JsonKey;
import org.sunbird.logging.LoggerUtil;
import org.sunbird.request.RequestContext;
import org.sunbird.util.ProjectUtil;
import org.sunbird.util.PropertiesCache;
......@@ -19,12 +20,12 @@ public class URLShortnerImpl implements URLShortner {
private static final String SUNBIRD_WEB_URL = "sunbird_web_url";
@Override
public String shortUrl(String url) {
public String shortUrl(String url, RequestContext context) {
boolean flag = false;
try {
flag = Boolean.parseBoolean(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_URL_SHORTNER_ENABLE));
} catch (Exception ex) {
logger.error("Exception occurred while parsing sunbird_url_shortner_enable key", ex);
logger.error(context,"Exception occurred while parsing sunbird_url_shortner_enable key", ex);
}
if (flag) {
String baseUrl = PropertiesCache.getInstance().getProperty("sunbird_url_shortner_base_url");
......@@ -34,7 +35,7 @@ public class URLShortnerImpl implements URLShortner {
PropertiesCache.getInstance().getProperty("sunbird_url_shortner_access_token");
}
String requestURL = baseUrl + accessToken + "&longUrl=" + url;
String response = HttpClientUtil.get(requestURL, null);
String response = HttpClientUtil.get(requestURL, null, context);
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> map = null;
if (!StringUtils.isBlank(response)) {
......@@ -43,7 +44,7 @@ public class URLShortnerImpl implements URLShortner {
Map<String, String> dataMap = (Map<String, String>) map.get("data");
return dataMap.get("url");
} catch (IOException | ClassCastException e) {
logger.error("Exception occurred while parsing " + e.getMessage(), e);
logger.error(context,"Exception occurred while parsing " + e.getMessage(), e);
}
}
}
......@@ -51,13 +52,13 @@ public class URLShortnerImpl implements URLShortner {
}
/** @return the url */
public String getUrl() {
public String getUrl(RequestContext context) {
if (StringUtils.isBlank(resUrl)) {
String webUrl = System.getenv(SUNBIRD_WEB_URL);
if (StringUtils.isBlank(webUrl)) {
webUrl = PropertiesCache.getInstance().getProperty(SUNBIRD_WEB_URL);
}
return shortUrl(webUrl);
return shortUrl(webUrl, context);
} else {
return resUrl;
}
......
......@@ -25,6 +25,7 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.sunbird.request.RequestContext;
@RunWith(PowerMockRunner.class)
@PowerMockIgnore({
......@@ -72,7 +73,7 @@ public class HttpClientUtilTest {
PowerMockito.when(EntityUtils.toByteArray(Mockito.any(HttpEntity.class))).thenReturn(bytes);
PowerMockito.when(httpclient.execute(Mockito.any(HttpGet.class))).thenReturn(response);
HttpClientUtil.getInstance();
String res = HttpClientUtil.get("http://localhost:80/user/read", headers());
String res = HttpClientUtil.get("http://localhost:80/user/read", headers(), null);
assertNotNull(res);
}
......@@ -96,7 +97,7 @@ public class HttpClientUtilTest {
HttpClientUtil.getInstance();
String res =
HttpClientUtil.post(
"http://localhost:80/user/read", "{\"message\":\"success\"}", headers());
"http://localhost:80/user/read", "{\"message\":\"success\"}", headers(), null);
assertNotNull(res);
}
......@@ -120,7 +121,7 @@ public class HttpClientUtilTest {
Map<String, String> fields = new HashMap<>();
fields.put("message", "success");
HttpClientUtil.getInstance();
String res = HttpClientUtil.postFormData("http://localhost:80/user/read", fields, headers());
String res = HttpClientUtil.postFormData("http://localhost:80/user/read", fields, headers(), null);
assertNotNull(res);
}
......@@ -144,7 +145,7 @@ public class HttpClientUtilTest {
HttpClientUtil.getInstance();
String res =
HttpClientUtil.patch(
"http://localhost:80/user/read", "{\"message\":\"success\"}", headers());
"http://localhost:80/user/read", "{\"message\":\"success\"}", headers(), null);
assertNotNull(res);
}
......@@ -166,7 +167,7 @@ public class HttpClientUtilTest {
PowerMockito.when(EntityUtils.toByteArray(Mockito.any(HttpEntity.class))).thenReturn(bytes);
PowerMockito.when(httpclient.execute(Mockito.any(HttpPatch.class))).thenReturn(response);
HttpClientUtil.getInstance();
String res = HttpClientUtil.delete("http://localhost:80/user/read", headers());
String res = HttpClientUtil.delete("http://localhost:80/user/read", headers(), null);
assertNotNull(res);
}
}
......@@ -34,9 +34,9 @@ public class KeycloakBruteForceAttackUtilTest {
when(ProjectUtil.getConfigValue(Mockito.anyString())).thenReturn("anyString");
when(KeycloakUtil.getAdminAccessTokenWithoutDomain(Mockito.any(RequestContext.class)))
.thenReturn("accessToken");
when(HttpClientUtil.get(Mockito.anyString(), Mockito.anyMap()))
when(HttpClientUtil.get(Mockito.anyString(), Mockito.anyMap(), Mockito.any(RequestContext.class)))
.thenReturn("{\"disabled\":true}");
when(HttpClientUtil.delete(Mockito.anyString(), Mockito.anyMap())).thenReturn("");
when(HttpClientUtil.delete(Mockito.anyString(), Mockito.anyMap(),Mockito.any(RequestContext.class))).thenReturn("");
}
@Test
......
......@@ -29,7 +29,7 @@ public class KeycloakUtilTest {
public void setup() {
PowerMockito.mockStatic(HttpClientUtil.class);
PowerMockito.mockStatic(ProjectUtil.class);
when(HttpClientUtil.postFormData(Mockito.anyString(), Mockito.anyMap(), Mockito.anyMap()))
when(HttpClientUtil.postFormData(Mockito.anyString(), Mockito.anyMap(), Mockito.anyMap(), Mockito.any(RequestContext.class)))
.thenReturn("{\"access_token\":\"accesstoken\"}");
when(ProjectUtil.getConfigValue(Mockito.anyString())).thenReturn("anyString");
}
......
......@@ -35,7 +35,7 @@ public class URLShortnerImplTest {
@Test
public void urlShortTest() {
URLShortner shortner = new URLShortnerImpl();
String url = shortner.shortUrl("https://staging.open-sunbird.org/");
String url = shortner.shortUrl("https://staging.open-sunbird.org/", null);
Assert.assertNotNull(url);
}
......@@ -50,7 +50,7 @@ public class URLShortnerImplTest {
}
URLShortnerImpl shortnerImpl = new URLShortnerImpl();
String url = shortnerImpl.getUrl();
String url = shortnerImpl.getUrl(null);
Assert.assertEquals(url, webUrl);
}
}
......@@ -378,16 +378,6 @@ public class ProjectUtilTest extends BaseHttpTest {
assertTrue(bool);
}
@Test
public void testSendGetRequestSuccessWithEkStepBaseUrl() throws Exception {
String ekStepBaseUrl = System.getenv(JsonKey.EKSTEP_BASE_URL);
if (StringUtils.isBlank(ekStepBaseUrl)) {
ekStepBaseUrl = PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_BASE_URL);
}
String response = HttpClientUtil.get(ekStepBaseUrl + "/search/health", headers);
assertNotNull(response);
}
@Test
public void testGetLmsUserIdSuccessWithoutFedUserId() {
String userid = ProjectUtil.getLmsUserId("1234567890");
......
......@@ -43,7 +43,7 @@ public class BackGroundNotificationActor extends BaseActor {
headers.put("Content-type", "application/json");
headers.put("requestId", reqObj.getRequestId());
ProjectUtil.setTraceIdInHeader(headers, reqObj.getRequestContext());
String response = HttpClientUtil.post(NOTIFICATION_SERVICE_URL, json, headers);
String response = HttpClientUtil.post(NOTIFICATION_SERVICE_URL, json, headers, reqObj.getRequestContext());
logger.info(
reqObj.getRequestContext(),
"BackGroundNotificationActor:callNotificationService :: Response =" + response);
......
......@@ -84,7 +84,8 @@ public class OrganisationBackgroundActor extends BaseActor {
+ "/"
+ tagId,
body,
header);
header,
context);
logger.info(
context,
"OrganisationBackgroundActor:registertag ,call end with id and status = "
......
......@@ -171,7 +171,8 @@ public class OrgServiceImpl implements OrgService {
(ekStepBaseUrl
+ PropertiesCache.getInstance().getProperty(JsonKey.EKSTEP_CHANNEL_REG_API_URL)),
reqString,
headerMap);
headerMap,
context);
logger.info(context, "end call for channel registration for org id ==" + req.get(JsonKey.ID));
} catch (Exception e) {
logger.error(
......@@ -229,7 +230,8 @@ public class OrgServiceImpl implements OrgService {
+ "/"
+ req.get(JsonKey.ID),
reqString,
headerMap);
headerMap,
context);
logger.info(
context, "end call for channel update for org id ==" + req.get(JsonKey.HASHTAGID));
} catch (Exception e) {
......
......@@ -32,8 +32,8 @@ public class ResetPasswordService {
context);
templateMap.put(
JsonKey.SET_PASSWORD_LINK, isUrlShortRequired ? urlShortner.shortUrl(url) : url);
return isUrlShortRequired ? urlShortner.shortUrl(url) : url;
JsonKey.SET_PASSWORD_LINK, isUrlShortRequired ? urlShortner.shortUrl(url,context) : url);
return isUrlShortRequired ? urlShortner.shortUrl(url, context) : url;
} else {
String url =
......@@ -43,8 +43,8 @@ public class ResetPasswordService {
KeycloakRequiredActionLinkUtil.VERIFY_EMAIL,
context);
templateMap.put(
JsonKey.VERIFY_EMAIL_LINK, isUrlShortRequired ? urlShortner.shortUrl(url) : url);
return isUrlShortRequired ? urlShortner.shortUrl(url) : url;
JsonKey.VERIFY_EMAIL_LINK, isUrlShortRequired ? urlShortner.shortUrl(url, context) : url);
return isUrlShortRequired ? urlShortner.shortUrl(url, context) : url;
}
}
......
Supports Markdown
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