code: private boolean isAuthorized(HttpServletRequest request){
  
  		if(Boolean.TRUE.equals(
  				request.getSession(true).getAttribute(AuthConstants.AUTH_SESSION_ATTR_NAME)
  		))
  			return true; // Session contains auth flag - user is authorized
  
  
  		// Session not contains auth flag. Trying to find valid auth cookie
  		final AuthApi api = APILookupUtility.getAuthApi();
  
  		if(request.getCookies() != null)
  			for(Cookie cookie : request.getCookies())
  				if(cookie.getName().equals(AuthConstants.AUTH_COOKIE_NAME)){
  
  					try {
  						if(api.userExists(
  								cookie.getValue()
  						)){
  							// Valid auth cookie found. Setting auth flag in session to true
  							request.getSession().setAttribute(AuthConstants.AUTH_SESSION_ATTR_NAME, true);
  							return true;
  						}
  					} catch (APIException e) {
  						log.error("Failed to decrypt user authorization cookie", e);
  						return false;
  					}
  
  				}
  
  		// No auth flag in session or valid auth cookie found. Seems that user is not authorized
  		return false;
  
  	}
docs: Check is current connection user
  authorized in moskito-inspect.
  First checks authorization flag in session attributes.
  Then tries to find valid authorization cookie, if flag not found.
  If cookie was found - sets authorization flag to true.
  @param request current servlet http request
  @return true - user is authorized in moskito-inspect
  false - no