<commit_before><?php

namespace Ilios\WebBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use phpCAS;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
 * Class ConfigController
 * @package Ilios\WebBundle\Controller
 */
class ConfigController extends Controller
{
    public function indexAction()
    {
        $configuration = [];
        $authenticationType = $this->container->getParameter('ilios_authentication.type');

        $configuration['type'] = $authenticationType;
        if ($authenticationType == 'shibboleth') {
            $loginPath = $this->container->getParameter('ilios_authentication.shibboleth.login_path');
            $url = $this->get('request')->getSchemeAndHttpHost();
            $configuration['loginUrl'] = $url . $loginPath;
        }
        if ($authenticationType === 'cas') {
            $cas = $this->container->get('ilios_authentication.cas.manager');

            $configuration['casLoginUrl'] = $cas->getLoginUrl();
        }
        $configuration['locale'] = $this->container->getParameter('locale');

        $ldapUrl = $this->container->getParameter('ilios_core.ldap.url');
        if (!empty($ldapUrl)) {
            $configuration['userSearchType'] = 'ldap';
        } else {
            $configuration['userSearchType'] = 'local';
        }

        return new JsonResponse(array('config' => $configuration));
    }<commit_msg>Auto merge of #1558 - jrjohnson:1557-shibbolethconfig, r=thecoolestguy<commit_after><?php

namespace Ilios\WebBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use phpCAS;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
 * Class ConfigController
 * @package Ilios\WebBundle\Controller
 */
class ConfigController extends Controller
{
    public function indexAction(Request $request)
    {
        $configuration = [];
        $authenticationType = $this->container->getParameter('ilios_authentication.type');

        $configuration['type'] = $authenticationType;
        if ($authenticationType == 'shibboleth') {
            $loginPath = $this->container->getParameter('ilios_authentication.shibboleth.login_path');
            $url = $request->getSchemeAndHttpHost();
            $configuration['loginUrl'] = $url . $loginPath;
        }
        if ($authenticationType === 'cas') {
            $cas = $this->container->get('ilios_authentication.cas.manager');

            $configuration['casLoginUrl'] = $cas->getLoginUrl();
        }
        $configuration['locale'] = $this->container->getParameter('locale');

        $ldapUrl = $this->container->getParameter('ilios_core.ldap.url');
        if (!empty($ldapUrl)) {
            $configuration['userSearchType'] = 'ldap';
        } else {
            $configuration['userSearchType'] = 'local';
        }

        return new JsonResponse(array('config' => $configuration));
    }
{'fraction_non_alphanumeric': 0.14234293193717276, 'fraction_numerical': 0.002617801047120419, 'mean_word_length': 3.4304347826086956, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '4818180', 'n_tokens_mistral': 849, 'n_tokens_neox': 832, 'n_words': 126}