<commit_before>package com.dutproject.coffee360.service.v1;

import java.io.IOException;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.dutproject.coffee360.config.Constants;
import com.dutproject.coffee360.model.bean.Account;
import com.dutproject.coffee360.model.bean.UserAccount;
import com.dutproject.coffee360.model.bo.AuthenticationBO;
import com.dutproject.coffee360.utils.FacebookOAuth;

@Path("/v1/auth")
public class AuthenticationService {
	private AuthenticationBO authenticationBO = new AuthenticationBO();

	@POST
	@Produces(MediaType.APPLICATION_XML)
	@Consumes("application/x-www-form-urlencoded")
	public Response authenticate(@FormParam("username") String username, @FormParam("password") String password) {
		try {

			// Authenticate the user using the credentials provided
			Account account = authenticationBO.authenticateAdmin(username, password);

			if (account == null)
				throw new Exception();

			// Issue a token for the user
			String token = authenticationBO.issueToken(account);

			// Return the token on the response
			return Response.ok(token).build();

		} catch (Exception e) {
			return Response.status(Response.Status.UNAUTHORIZED).build();
		}
	}
	
	private String requestAccessToken(String code) throws IOException {<commit_msg>- change admin login service path<commit_after>package com.dutproject.coffee360.service.v1;

import java.io.IOException;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.dutproject.coffee360.config.Constants;
import com.dutproject.coffee360.model.bean.Account;
import com.dutproject.coffee360.model.bean.UserAccount;
import com.dutproject.coffee360.model.bo.AuthenticationBO;
import com.dutproject.coffee360.utils.FacebookOAuth;

@Path("/v1/auth")
public class AuthenticationService {
	private AuthenticationBO authenticationBO = new AuthenticationBO();

	@POST
	@Path("/admin")
	@Produces(MediaType.APPLICATION_XML)
	@Consumes("application/x-www-form-urlencoded")
	public Response authenticate(@FormParam("username") String username, @FormParam("password") String password) {
		try {

			// Authenticate the user using the credentials provided
			Account account = authenticationBO.authenticateAdmin(username, password);

			if (account == null)
				throw new Exception();

			// Issue a token for the user
			String token = authenticationBO.issueToken(account);

			// Return the token on the response
			return Response.ok(token).build();

		} catch (Exception e) {
			return Response.status(Response.Status.UNAUTHORIZED).build();
		}
	}
	
	private String requestAccessToken(String code) throws IOException {
{'fraction_non_alphanumeric': 0.11262577085361895, 'fraction_numerical': 0.012982797792924375, 'mean_word_length': 5.090909090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2410027', 'n_tokens_mistral': 1035, 'n_tokens_neox': 935, 'n_words': 206}