<commit_before><?php

require_once('../../_include.php');


require_once('SimpleSAML/Utilities.php');
require_once('SimpleSAML/Session.php');
require_once('SimpleSAML/Logger.php');
require_once('SimpleSAML/XML/MetaDataStore.php');
require_once('SimpleSAML/XML/SAML20/AuthnRequest.php');
require_once('SimpleSAML/Bindings/SAML20/HTTPPost.php');
require_once('SimpleSAML/XHTML/Template.php');

$session = SimpleSAML_Session::getInstance();

$logger = new SimpleSAML_Logger();


$logger->log(LOG_INFO, $session->getTrackID(), 'SAML2.0', 'SP.AssertionConsumerService', 'EVENT', 'Access', 
	'Accessing SAML 2.0 SP endpoint AssertionConsumerService');

try {
	
	$config = SimpleSAML_Configuration::getInstance();	
	$metadata = new SimpleSAML_XML_MetaDataStore($config);

	$binding = new SimpleSAML_Bindings_SAML20_HTTPPost($config, $metadata);
	$authnResponse = $binding->decodeResponse($_POST);
	
	$authnResponse->validate();
	
	$session = $authnResponse->createSession();
	if (isset($session)) {
		
		$attributes = $session->getAttributes();

		$logger->log(LOG_NOTICE, $session->getTrackID(), 'SAML2.0', 'SP.AssertionConsumerService', 'AuthnResponse', '-', 
			'Successfully created local session from Authentication Response');
	
		$relayState = $authnResponse->getRelayState();
		if (isset($relayState)) {
			SimpleSAML_Utilities::redirect($relayState);<commit_msg>SAML2:SP:AssertionConsumerService - Allow the AssertionConsumer to create new sessions if the user arrives without a valid session.<commit_after><?php

require_once('../../_include.php');


require_once('SimpleSAML/Utilities.php');
require_once('SimpleSAML/Session.php');
require_once('SimpleSAML/Logger.php');
require_once('SimpleSAML/XML/MetaDataStore.php');
require_once('SimpleSAML/XML/SAML20/AuthnRequest.php');
require_once('SimpleSAML/Bindings/SAML20/HTTPPost.php');
require_once('SimpleSAML/XHTML/Template.php');

/* Get the session object for the user. Create a new session if no session
 * exists for this user.
 */
$session = SimpleSAML_Session::getInstance(TRUE);

$logger = new SimpleSAML_Logger();


$logger->log(LOG_INFO, $session->getTrackID(), 'SAML2.0', 'SP.AssertionConsumerService', 'EVENT', 'Access', 
	'Accessing SAML 2.0 SP endpoint AssertionConsumerService');

try {
	
	$config = SimpleSAML_Configuration::getInstance();	
	$metadata = new SimpleSAML_XML_MetaDataStore($config);

	$binding = new SimpleSAML_Bindings_SAML20_HTTPPost($config, $metadata);
	$authnResponse = $binding->decodeResponse($_POST);
	
	$authnResponse->validate();
	
	$session = $authnResponse->createSession();
	if (isset($session)) {
		
		$attributes = $session->getAttributes();

		$logger->log(LOG_NOTICE, $session->getTrackID(), 'SAML2.0', 'SP.AssertionConsumerService', 'AuthnResponse', '-', 
			'Successfully created local session from Authentication Response');
	
		$relayState = $authnResponse->getRelayState();
		if (isset($relayState)) {
			SimpleSAML_Utilities::redirect($relayState);
{'fraction_non_alphanumeric': 0.15470548408937035, 'fraction_numerical': 0.008463100880162491, 'mean_word_length': 6.986486486486487, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6601777', 'n_tokens_mistral': 1011, 'n_tokens_neox': 935, 'n_words': 156}