<commit_before>/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2014 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */
package org.geomajas.plugin.deskmanager.command.security;

import org.geomajas.command.Command;
import org.geomajas.plugin.deskmanager.command.security.dto.AuthenticateUserRequest;
import org.geomajas.plugin.deskmanager.command.security.dto.AuthenticateUserResponse;
import org.geomajas.plugin.deskmanager.security.LoginService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Command that will retrieve the profiles of a user for a specific geodesk.
 *
 * @author <NAME>
 */
@Component(AuthenticateUserRequest.COMMAND)
public class AuthenticateUserCommand implements Command<AuthenticateUserRequest, AuthenticateUserResponse> {

	private final Logger log = LoggerFactory.getLogger(AuthenticateUserCommand.class);

	@Autowired
	private LoginService loginService;

	public AuthenticateUserResponse getEmptyCommandResponse() {
		return new AuthenticateUserResponse();
	}

	public void execute(AuthenticateUserRequest request, AuthenticateUserResponse response) throws Exception {
		try {
			String token = loginService.checkLogin(request.getUserName(), request.getPassword());
			response.setSecurityToken(token);
			log.info("Autentication Request for " + request.getUserName() + " successfully executed.");
		} catch (Exception ex) {
			log.error("Autentication exception for username " + request.getUserName(), ex);
			throw ex;
		}
	}
}<commit_msg>GBE-482: make deskmanager security respond as static security: no exception<commit_after>/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2014 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */
package org.geomajas.plugin.deskmanager.command.security;

import org.geomajas.command.Command;
import org.geomajas.plugin.deskmanager.command.security.dto.AuthenticateUserRequest;
import org.geomajas.plugin.deskmanager.command.security.dto.AuthenticateUserResponse;
import org.geomajas.plugin.deskmanager.security.LoginService;
import org.geomajas.security.GeomajasSecurityException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Command that will retrieve the profiles of a user for a specific geodesk.
 *
 * @author <NAME>
 */
@Component(AuthenticateUserRequest.COMMAND)
public class AuthenticateUserCommand implements Command<AuthenticateUserRequest, AuthenticateUserResponse> {

	private final Logger log = LoggerFactory.getLogger(AuthenticateUserCommand.class);

	@Autowired
	private LoginService loginService;

	public AuthenticateUserResponse getEmptyCommandResponse() {
		return new AuthenticateUserResponse();
	}

	public void execute(AuthenticateUserRequest request, AuthenticateUserResponse response) throws Exception {
		try {
			String token = loginService.checkLogin(request.getUserName(), request.getPassword());
			response.setSecurityToken(token);
			log.info("Autentication Request for " + request.getUserName() + " successfully executed.");
		} catch (GeomajasSecurityException ex) {
			log.error("Autentication exception for username " + request.getUserName(), ex);
			// return an empty response, in complyance with static security
		}
	}
}
{'fraction_non_alphanumeric': 0.08993522670652715, 'fraction_numerical': 0.0057299451918286, 'mean_word_length': 5.560457516339869, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6547303', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1109, 'n_words': 298}