Subversion Repositories SmartDukaan

Rev

Rev 26743 | Rev 27235 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26743 Rev 27229
Line 20... Line 20...
20
public class CookiesProcessor {
20
public class CookiesProcessor {
21
	
21
	
22
	private static final Logger LOGGER = LogManager.getLogger(CookiesProcessor.class);
22
	private static final Logger LOGGER = LogManager.getLogger(CookiesProcessor.class);
23
	
23
	
24
	public LoginDetails getCookiesObject(HttpServletRequest request) throws ProfitMandiBusinessException{
24
	public LoginDetails getCookiesObject(HttpServletRequest request) throws ProfitMandiBusinessException{
-
 
25
		boolean readOnly = false;
25
		Cookie[] cookies = request.getCookies();
26
		Cookie[] cookies = request.getCookies();
26
		if (cookies == null){
27
		if (cookies == null){
27
			throw new ProfitMandiBusinessException("cookies", "", "GE_1008");
28
			throw new ProfitMandiBusinessException("cookies", "", "GE_1008");
28
		}
29
		}
29
		String fofoIdFound = null, emailIdFound = null, roleIdsString = null;
30
		String fofoIdFound = null, emailIdFound = null, roleIdsString = null;
Line 37... Line 38...
37
			}
38
			}
38
			if(cookie.getName().equals(ProfitMandiConstants.ROLE_IDS) && cookie.getValue() != null){
39
			if(cookie.getName().equals(ProfitMandiConstants.ROLE_IDS) && cookie.getValue() != null){
39
				roleIdsString = cookie.getValue();
40
				roleIdsString = cookie.getValue();
40
				//LOGGER.info("roleNameString is {}", roleNamesString);
41
				//LOGGER.info("roleNameString is {}", roleNamesString);
41
			}
42
			}
-
 
43
			if(cookie.getName().equals(ProfitMandiConstants.READONLY_KEY) && cookie.getValue() != null){
-
 
44
				readOnly = true;
-
 
45
				//LOGGER.info("roleNameString is {}", roleNamesString);
-
 
46
			}
42
			if(fofoIdFound != null && emailIdFound != null && roleIdsString != null){
47
			if(fofoIdFound != null && emailIdFound != null && roleIdsString != null){
43
				break;
48
				break;
44
			}
49
			}
45
		}
50
		}
46
		
51
		
Line 61... Line 66...
61
			Set<Integer> roleIds = new HashSet<>();
66
			Set<Integer> roleIds = new HashSet<>();
62
			for(String roleId : roleIdStrings){
67
			for(String roleId : roleIdStrings){
63
				roleIds.add(Integer.valueOf(roleId));
68
				roleIds.add(Integer.valueOf(roleId));
64
			}
69
			}
65
			fofoDetails.setRoleIds(roleIds);
70
			fofoDetails.setRoleIds(roleIds);
-
 
71
			fofoDetails.setReadOnly(readOnly);
66
			return fofoDetails;
72
			return fofoDetails;
67
		}
73
		}
68
		
74
		
69
	}
75
	}
70
	
76
	
Line 92... Line 98...
92
		Cookie cookieFofoFlag = new Cookie(ProfitMandiConstants.FOFO_FLAG, "");
98
		Cookie cookieFofoFlag = new Cookie(ProfitMandiConstants.FOFO_FLAG, "");
93
		cookieFofoFlag.setMaxAge(0);
99
		cookieFofoFlag.setMaxAge(0);
94
		cookieFofoFlag.setDomain(request.getServerName());
100
		cookieFofoFlag.setDomain(request.getServerName());
95
		cookieFofoFlag.setPath(request.getContextPath());
101
		cookieFofoFlag.setPath(request.getContextPath());
96
		
102
		
-
 
103
		Cookie cookieReadOnly = new Cookie(ProfitMandiConstants.READONLY_KEY, "");
-
 
104
		cookieFofoFlag.setMaxAge(0);
-
 
105
		cookieFofoFlag.setDomain(request.getServerName());
-
 
106
		cookieFofoFlag.setPath(request.getContextPath());
-
 
107
		
97
		response.addCookie(cookieFofoId);
108
		response.addCookie(cookieFofoId);
98
		response.addCookie(cookieEmailId);
109
		response.addCookie(cookieEmailId);
99
		response.addCookie(cookieRoleNames);
110
		response.addCookie(cookieRoleNames);
100
		response.addCookie(cookieFofoFlag);
111
		response.addCookie(cookieFofoFlag);
-
 
112
		response.addCookie(cookieReadOnly);
101
	}
113
	}
102
}
114
}