public String fetchUser(HttpServletRequest request) { ALNTLogger.info( "ALNTHttpHeaderValidator".getClass().getName(), "fetchUser", "fetching user using HTTP header"); String headerName = ""; String encodedHeaderValue = ""; String userId = ""; Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { headerName = (String) headerNames.nextElement(); if (headerName.equalsIgnoreCase(CommonConstants.CALLING_APP_LOGGEDIN_USER)) { encodedHeaderValue = request.getHeader(headerName); break; } } if (encodedHeaderValue != null && !encodedHeaderValue.equals("")) { try { userId = EncodeDecodeUtil.decodeBase64(encodedHeaderValue); } catch (Exception e) { ALNTLogger.error("ALNTHttpHeaderValidator".getClass().getName(), "fetchUser", e, true); userId = ""; } } return userId; }
public String fetchUser(HttpServletRequest request) { ALNTLogger.info( "ALNTEncodedURLValidator".getClass().getName(), "fetchUser", "fetching user using Encoded URL"); String userId = ""; String encodedUserId = request.getQueryString().contains(CommonConstants.CALLING_APP_LOGGEDIN_USER) ? request.getParameter(CommonConstants.CALLING_APP_LOGGEDIN_USER) : null; if (StringUtils.isNotNullOrNotEmpty(encodedUserId)) { try { userId = EncodeDecodeUtil.decodeBase64(encodedUserId); } catch (Exception e) { ALNTLogger.error("ALNTEncodedURLValidator".getClass().getName(), "fetchUser", e, true); userId = ""; } } return userId; }