<commit_before><?php
/*
 * This file is part of the SamlBundle.
 *
 * (c) <NAME> <<EMAIL>>
 *
 */
namespace PDias\SamlBundle\Security\Http\Logout;

//use Symfony\Component\HttpFoundation\RedirectResponse; 
use Symfony\Component\HttpFoundation\Request; 
use Symfony\Component\HttpFoundation\Response; 
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; 
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface; 

/**
 * Handles logging out of Saml when the user logs out of Symfony
 *
 * @package    SamlBundle
 * @subpackage Security\Http\Logout
 * @author     <NAME> <<EMAIL>>
 */
class SamlLogoutHandler implements LogoutHandlerInterface
{
    protected $serviceprovider;

    public function __construct($serviceprovider)
    {
        $this->serviceprovider = $serviceprovider;
    }
        
    public function logout(Request $request, Response $response, TokenInterface $token)
    {
        $auth = new \SimpleSAML_Auth_Simple($this->serviceprovider); 
        $auth->requireAuth(); 
        
        if($auth->isAuthenticated()) {
            $auth->logout();
        }
    }
}<commit_msg>Customization of SamlLogoutHandler::logout()<commit_after><?php
/*
 * This file is part of the SamlBundle.
 *
 * (c) <NAME> <<EMAIL>>
 *
 */
namespace PDias\SamlBundle\Security\Http\Logout;

//use Symfony\Component\HttpFoundation\RedirectResponse; 
use Symfony\Component\HttpFoundation\Request; 
use Symfony\Component\HttpFoundation\Response; 
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; 
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface; 

/**
 * Handles logging out of Saml when the user logs out of Symfony
 *
 * @package    SamlBundle
 * @subpackage Security\Http\Logout
 * @author     <NAME> <<EMAIL>>
 */
class SamlLogoutHandler implements LogoutHandlerInterface
{
    protected $serviceprovider;

    public function __construct($serviceprovider)
    {
        $this->serviceprovider = $serviceprovider;
    }
        
    public function logout(Request $request, Response $response, TokenInterface $token)
    {
        $auth = new \SimpleSAML_Auth_Simple($this->serviceprovider); 
        
        if($auth->isAuthenticated()) {
            if(method_exists($response, 'getTargetUrl')) {
                $auth->logout($response->getTargetUrl());
            } else {
                $auth->logout();
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.11548013245033113, 'fraction_numerical': 0.0, 'mean_word_length': 3.2703180212014136, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 26, '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': '965086', 'n_tokens_mistral': 701, 'n_tokens_neox': 690, 'n_words': 139}