Checking log in credentials

	
	// BO necessary util classes and defining instances for each class
	IInfoStore boInfoStore = null;
	IInfoStore boInfoStore2 = null;
	IInfoObject boIInfoObject = null;
	IInfoObject boIInfoObject2 = null;
	IInfoObjects boInfoObjects = null;
	IInfoObjects boInfoObjects2 = null;
	SDKException sdkException = null;
	IEnterpriseSession boEnterpriseSession = null;
	IPluginMgr boPluginMgr;
	IPluginInfo boPluginInfo;
	IUser boCurUser = null;
	IUserGroup boGroup = null;
	IUserAliases allias = null;

boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(
					USERNAME, PASSWORD, SERVER, AUTHTYPE);
			boInfoStore = (IInfoStore) boEnterpriseSession.getService("",
					"InfoStore");
	boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(
					USERNAME, PASSWORD, SERVER, AUTHTYPE);
			boInfoStore = (IInfoStore) boEnterpriseSession.getService("",
					"InfoStore");


	public boolean checkUserEnterpriseLogOn(String username, String password,
			String server) {
		try {

			logger.debug("check user enterprise log on " + username + password
					+ server);

			ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
			IEnterpriseSession iEnterpriseSession = sessionMgr.logon(username,
					password, server, "secEnterprise");
			// user exists
			return true;

		} catch (SDKException e) {
			/*
			 * No need for logging if exception is thrown means that the given
			 * credentials are wrong.
			 */
			return false;
		}
	}

Leave a Reply

Your email address will not be published. Required fields are marked *