Authentification SSO

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Authentification SSO

Re: Authentification SSO

par Megadeth » 27 nov. 2014, 23:58

Une bonne piste qui n'utilise pas de système de jeton etc...
http://forum.hardware.fr/hfr/Programmat ... 8217_1.htm

Mega
;)

Re: Authentification SSO

par guigui69 » 27 nov. 2014, 19:09

non pas de CMS.

Oui mon but c'est que quand mes utilisatuer se connecter sur notre intranet il repere son nom utilisateur AD et qu'il authentifie

guigui69

Re: Authentification SSO

par Megadeth » 26 nov. 2014, 16:22

Slt,

Grossomodo tu cherches à faire matcher la session windows avec ton ad pour ne pas avoir à resaisir des énièmes login et mot de passe ?

Tu peux utiliser les fonctions ldap ou pas sur ton serveur ? Tu utilises un CMS ?

Mega
;)

Authentification SSO

par guigui69 » 26 nov. 2014, 15:06

Bonjour à tous,

Je dispose d'un intranet sous Apache (debian) en php.

Mes utilisateur s'authentifie avec cette page:
<?php session_start();
include ("php/fonction.bdd.php"); 
include ("php/fonction.site.php"); 
	
$ua = $_SERVER['HTTP_USER_AGENT'];

//echo '<br/>>>>>>>>>>>>> '.$ua.'<<<<<<<<<<<<<<<<<<br/>';
if (preg_match('/\bmsie 6/i', $ua) && !preg_match('/\bopera/i', $ua))
  {

  

  <br/><br/><br/><br/><br/><br/>
  Cordialement";
  }
  else
  {

If(isset($_POST['mdp']) && isset($_POST['login']))
{
function stripgpc($value) {
if(get_magic_quotes_gpc()) $value = stripslashes($value);
return $value;
}

$mdp = isset($_POST['mdp']) ? (stripgpc($_POST['mdp'])) : '';
$login = isset($_POST['login']) ? stripgpc($_POST['login']) : '';

//echo $mdp;
//echo $login;
if(!empty($mdp) && !empty($login)) 
{
connexion_mysql();

$resultat= auth_ad_php("1555555");
//$resultat=1;
if($resultat==1)
{
$selection = sprintf("select * FROM users WHERE users_disabled='0' AND login ='%s'",mysql_real_escape_string($login)); 
//echo "select * FROM users WHERE users_disabled='0' AND login ='%s'";
$query = mysql_query($selection) or die(mysql_error());
$total_reponse = mysql_num_rows($query);
$field = mysql_num_fields($query );
$totalReponse = mysql_fetch_array($query);

if ($total_reponse == 1 ) 
		{
		for ( $i = 0; $i < $field; $i++ ) 
		{
                  
       $_SESSION[mysql_field_name($query, $i)] = $totalReponse[$i];
        }
		print_r($_SESSION);
        header("Location: index.php"); 
		exit(); 
		}
		else 
		{
		header("Location: index.php"); 
		exit();
		} 
		}
		else
		{
		echo 'kkkkkkkkkkkkkkkkkkkk';
		header("Location: index.php"); 
		exit();
		}
		}
else
	{
 $message = 'login ou mot de passe manquant';
    }   		
}

 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Intranet Groupe Amplitude</title>
<link rel="shortcut icon" type="image/png" href="img/favicon.png" />
<link rel="stylesheet" type="text/css" href="css/site.css" media="screen" />
<link href="http://fonts.googleapis.com/css?family=Loved by the King" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="conteneur">
			<h1 id="header"><a href="index.php"></a></h1>
			

<?php
if(!isset($_SESSION['login']) OR !isset($_SESSION['id_users'])) 
{
	echo ' 
	<form method="post" action="index.php">
	<table id="login">
	<tr><td colspan="2" align="left"><img src="img/identifiant.png" alt="ico" style="font-size: 12px;"/> IDENTIFIANT DE CONNEXION </td></tr>
	<tr><td><input type="text" name="login" maxlength="32" size="26" value="  login" class="gris" onfocus="javascript:this.value=\'\';"/></td><td><input type="password" name="mdp"  size="26" maxlength="32" value="  Mot de passe" onfocus="javascript:this.value=\'\';" class="gris"/></td></tr>
    <tr><td colspan="2" align="right"><input type="image" src="img/valider.png" alt="Envoyer" name="validation" onclick="submit"/></td></tr>
	</table>
	</form>';
 }
else
{
	echo '  <table id="login"><tr><td>Bienvenue: '.$_SESSION["nom"].' '.$_SESSION["prenom"].'</td></tr></table>';
}

?> 

<div id="contenu"> <span class="policeLovedbytheKing" >BIENVENUE SUR L INTRANET GROUPE AMPLITUDE</span><br/> 

<?php
if(isset($_SESSION['login']) ) {
if($_SESSION["bc_application"]==1) {	echo '<p><img src="img/file.png" alt="ok" /><a href="bc/index.php"> Accès à l\'application Bon de Commande </a></p>';}
if($_SESSION["f_application"]==1) {	echo '<p><img src="img/file.png" alt="ok" /><a href="f/index.php"> Accès à l\'application "Facture" </a></p>';}  
if($_SESSION["rh_application"]==1) {	echo '<p><img src="img/file.png" alt="ok" /><a href="rh/index.php">  application RH  </a></p>';}
if($_SESSION["com_application"]==1) {	echo '<p><img src="img/file.png" alt="ok" /><a href="com/index.php">  application Commerciale  </a></p>';}
}
else
{
echo '<p>veuillez vous identifier pour accerder aux applications extranet</p>';
}

?>

</div>
</div>
<div id="footer"> <?php footer(); ?> <a href="fichiers/">  fichiers  </a> </div>
</body>
</html>
<?php	
//print_r($_SESSION);

//foreach($_POST as $key => $val) echo '$_POST["'.$key.'"]='.$val.'<br />';

}
?>

les utilisateurs s'authentifie avec ceci:

Code : Tout sélectionner

auth_ad_php("10.22.55.44",$login,$mdp,"@local.lan");
Il utilise le meme login et mot de passe de AD si c'est OK , après le php regarde si il a un compte utilisateur dans ma base de donnée.


Je voudrais savoir si il y a un moyen de faire du SSO? la personne ouvre la page depuis Internet explorer il récupère l'information pour s'authentifie l'utilisateur sur le poste en question et vérifie ces informations dans AD ...


Est-ce réalisable ?

Merci d'avance pour votre aide

guigui69