<commit_before>package openid4java.sample.rp.servlet;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import openid4java.sample.rp.helper.ConsumerManagerProvider;

import org.openid4java.consumer.ConsumerManager;
import org.openid4java.discovery.DiscoveryInformation;
import org.openid4java.message.AuthRequest;

@WebServlet(name="auth", displayName="auth", urlPatterns={"/auth"}, loadOnStartup=1)
public class OpenIDAuthServlet extends HttpServlet {

	private static final long serialVersionUID = -6951091489143426313L;
	private ConsumerManager cm = ConsumerManagerProvider.getConsumerManager();

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		this.doPost(req, res);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

		// auth request info
		Map<Object, Object> ri = new LinkedHashMap<Object, Object>();

		// view info
		req.setAttribute("info", ri);

		try {
			// input validation
			String id = req.getParameter("id");
			if (id == null || "".equals(id)){
				throw new RuntimeException("OpenID Provider (OP) id is required");
			}

			// discovery
			DiscoveryInformation di = cm.associate(cm.discover(req.getParameter("id")));

			// auth request
			AuthRequest ar = cm.authenticate(di, "http://ava.universidade.uol.com.br:8080/openid4java-rp-sample/return");
			String ru = ar.getDestinationUrl(true);<commit_msg>removed hard-coded URL<commit_after>package openid4java.sample.rp.servlet;

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

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import openid4java.sample.rp.helper.ConsumerManagerProvider;

import org.openid4java.consumer.ConsumerManager;
import org.openid4java.discovery.DiscoveryInformation;
import org.openid4java.message.AuthRequest;

@WebServlet(name="auth", displayName="auth", urlPatterns={"/auth"}, loadOnStartup=1)
public class OpenIDAuthServlet extends HttpServlet {

	private static final long serialVersionUID = -6951091489143426313L;
	private ConsumerManager cm = ConsumerManagerProvider.getConsumerManager();

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		this.doPost(req, res);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

		// auth request info
		Map<Object, Object> ri = new LinkedHashMap<Object, Object>();

		// view info
		req.setAttribute("info", ri);

		try {
			// input validation
			String id = req.getParameter("id");
			if (id == null || "".equals(id)){
				throw new RuntimeException("OpenID Provider (OP) id is required");
			}

			// discovery
			DiscoveryInformation di = cm.associate(cm.discover(req.getParameter("id")));

			// auth request
			AuthRequest ar = cm.authenticate(di, req.getRequestURL().toString().replaceFirst("/auth", "/return"));
			String ru = ar.getDestinationUrl(true);
{'fraction_non_alphanumeric': 0.11146496815286625, 'fraction_numerical': 0.01592356687898089, 'mean_word_length': 5.618773946360153, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6202819', 'n_tokens_mistral': 1075, 'n_tokens_neox': 988, 'n_words': 224}