Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2920 connectés 

  FORUM HardWare.fr
  Windows & Software

  Authentification site web et active directory ??

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Authentification site web et active directory ??

n°1455520
chuckboy_0​1
Posté le 17-02-2004 à 21:40:42  profilanswer
 

Bonjour
 
J'Aimerais faire un site web local pour mon entreprise. Je me demandais si c'est possible que certaines pages ne soit accessible que par un certain nombre de mes usagers. Est-il possible que l'acces ce fasse a partir de l'active directory de mon reseau ??
 
 
Merci


Message édité par chuckboy_01 le 18-02-2004 à 15:23:30
mood
Publicité
Posté le 17-02-2004 à 21:40:42  profilanswer
 

n°1456553
chuckboy_0​1
Posté le 18-02-2004 à 15:22:38  profilanswer
 

Et up !!

n°1456556
Jef34
Je ferai mieux demain
Posté le 18-02-2004 à 15:24:38  profilanswer
 

Oui sur ton serveur IIS tu choisis autentification intégrée et tu utilises les ACL du NTFS sur ton server Web IIS.

n°1456563
chuckboy_0​1
Posté le 18-02-2004 à 15:29:16  profilanswer
 

Ok , si j'ai bien compris integrated windows authentification et je change mes droit sur les page concerner c'est bien ca ?
 
C'est possible d'afficher sur mon site , le groupe dans lequel user fais partie.  
 
 
Moi et l'active directory ...  
 
Merci

n°1456578
Requin
Posté le 18-02-2004 à 15:38:05  profilanswer
 

Sinon depuis les pages ASP tu peux utiliser ADSI qui permet d'avoir une interface sur les comptes avec le modèle "plat" de Windows NT ou le modèle hiérarchique d'Active Directory.
 
Je me rappelle avoir fait une application Web basée sur d'une part une authentification Windows (page web customisée avec un formulaire) et l'appartenance à un groupe d'utilisateur pour déterminer ce qui devait être affiché en focntion du groupe... de sorte qu'une modification dans AD était automatiquement répercutée sur l'application.

n°1456597
chuckboy_0​1
Posté le 18-02-2004 à 15:55:56  profilanswer
 

requin , c'est exactement ce que je veut , mais dit plus clairement :)
 
merci , je vais regarder de ce cote

n°1456613
Requin
Posté le 18-02-2004 à 16:03:18  profilanswer
 

Voici le code que j'avais utilisé, de mémoire pour changer el mot de passe en connaissant l'ancien (simple accès utilisateur), remettre à zéro un mot de passe d'un compte donné (nécessite u ncomtpe administrateur) et pour vérifier l'appartenance à un groupe :
 

Code :
  1. ' to change password
  2.    ' parameters :
  3.    '  - strContainer   = AD path to object (without object name)
  4.    '  - strUsername    = user account
  5.    '  - strOldPassword = old password
  6.    '  - strNewPassword = new password
  7.    ' returns an error code (binary sum) :
  8.    '  - 0  = no error
  9.    '  - 1  = bad container
  10.    '  - 2  = bad username
  11.    '  - 4  = bad old password
  12.    '  - 8  = bad new password
  13.    '  - 16 = unable to change password
  14.    '  - 32 = unable to authenticate user
  15.    Function LDAPChangePW(                                                    _
  16.                          strContainer                                      , _
  17.                          strUsername                                       , _
  18.                          strOldPassword                                    , _
  19.                          strNewPassword                                      _
  20.                         )
  21.       ' error handling
  22.       On Error Resume Next
  23.       intReturnCode = 0
  24.  
  25.       ' check parameters
  26.       If (VarType(strContainer) = vbError OR strContainer = "" ) Then
  27.          intReturnCode = intReturnCode + 1
  28.       End If
  29.       If (VarType(strUsername) = vbError OR strUserName = "" ) Then
  30.          intReturnCode = intReturnCode + 2
  31.       End If
  32.       If (VarType(strOldPassword) = vbError) Then
  33.          intReturnCode = intReturnCode + 4
  34.       End If
  35.       If (VarType(strNewPassword) = vbError) Then
  36.          intReturnCode = intReturnCode + 8
  37.       End If
  38.  
  39.       ' create path
  40.       strLDAPUsername = "cn=" & strUsername & "," & strContainer
  41.       ' open connection to LDAP
  42.       Set adsNameSpace = GetObject("LDAP:" )
  43.       ' attempt to authenticate the user in the tree using the username and
  44.       ' the current password
  45.       Err.Clear
  46.       Set adsUser = adsNamespace.OpenDSObject(                               _
  47.                                               "LDAP://" & strLDAPUsername  , _
  48.                                               strLDAPUsername              , _
  49.                                               strOldPassword               , _
  50.                                               0                              _
  51.                                              )
  52.       If (Err = 0) Then
  53.          ' attempt to change password
  54.          Err.Clear
  55.          adsUser.ChangePassword CStr(strOldPassword), CStr(strNewPassword)
  56.          If Err <> 0 Then
  57.             intReturnCode = intReturnCode + 16
  58.          End If
  59.       Else
  60.          intReturnCode = intReturnCode + 32
  61.       End If
  62.      
  63.       ' return code
  64.       LDAPChangePW = intReturnCode
  65.    End Function
  66.    ' to reset password (user MUST have administrative privilege)
  67.    ' parameters :
  68.    '  - strContainer   = AD path to object (without object name)
  69.    '  - strUsername    = Account username
  70.    '  - strNewPassword = New password to set
  71.    '  - strAdmin       = AD path to an administrator user
  72.    '  - strAdminPass   = Aministrator's password
  73.    ' returns an error code (binary sum) :
  74.    '  - 0  = no error
  75.    '  - 1  = bad container
  76.    '  - 2  = bad username
  77.    '  - 4  = bad new password
  78.    '  - 8  = unable to set password
  79.    '  - 16 = unable to authenticate user
  80.    Function LDAPSetPW(                                                       _
  81.                       strContainer                                         , _
  82.                       strUsername                                          , _
  83.                       strNewPassword                                       , _
  84.                       strAdmin                                             , _
  85.                       strAdminPass                                           _
  86.                      )
  87.       ' error handling
  88.       On Error Resume Next
  89.       intReturnCode = 0
  90.       ' check parameters
  91.       If (VarType(strContainer) = vbError OR strContainer = "" ) Then
  92.          intReturnCode = intReturnCode + 1
  93.       End If
  94.       If (VarType(strUsername) = vbError OR strUsername = "" ) Then
  95.          intReturnCode = intReturnCode + 2
  96.       End If
  97.       If (VarType(strNewPassword) = vbError) Then
  98.          intReturnCode = intReturnCode + 4
  99.       End If
  100.       ' create path
  101.       strLDAPUsername = "LDAP://cn=" & strUsername & "," & strContainer
  102.       ' open connection to LDAP
  103.       Set adsNameSpace = GetObject("LDAP:" )
  104.       ' attempt to authenticate the user in the tree using the username and
  105.       ' the current password
  106.       Err.Clear
  107.       Set adsUser = adsNamespace.OpenDSObject(                               _
  108.                                               CStr(strLDAPUsername)        , _
  109.                                               strAdmin                     , _
  110.                                               strAdminPass                 , _
  111.                                               0                              _
  112.                                              )
  113.       If (Err = 0) Then
  114.          ' attempt to change password
  115.          Err.Clear
  116.          adsUser.SetPassword CStr(strNewPassword)
  117.          If Err <> 0 Then
  118.             intReturnCode = intReturnCode + 8
  119.          End If
  120.       Else
  121.          intReturnCode = intReturnCode + 16
  122.       End If
  123.      
  124.       ' return code
  125.       LDAPSetPW = intReturnCode
  126.    End Function
  127.    ' to check member's appartenance
  128.    ' parameters :
  129.    '  - strContainer   = AD path to object (without object name)
  130.    '  - strUsername    = Account username
  131.    '  - strPassword    = New password to set
  132.    '  - strGroup       = AD path to a group
  133.    ' returns an error code (binary sum) :
  134.    '  - 0  = no error, user is a member of this group
  135.    '  - 1  = bad container
  136.    '  - 2  = bad username
  137.    '  - 4  = bad password
  138.    '  - 8  = bad group
  139.    '  - 16 = unable to authenticate user
  140.    '  - 32 = no error, user isn't a member of this group
  141.    Function LDAPIsMember(                                                    _
  142.                          strContainer                                      , _
  143.                          strUserName                                       , _
  144.                          strPassword                                       , _
  145.                          strGroup                                            _
  146.                         )
  147.       ' error handling
  148.       On Error Resume Next
  149.       intReturnCode = 0
  150.       ' check parameters
  151.       If (VarType(strContainer) = vbError OR strContainer = "" ) Then
  152.          intReturnCode = intReturnCode + 1
  153.       End If
  154.       If (VarType(strUsername) = vbError OR strUsername = "" ) Then
  155.          intReturnCode = intReturnCode + 2
  156.       End If
  157.       If (VarType(strPassword) = vbError) Then
  158.          intReturnCode = intReturnCode + 4
  159.       End If
  160.       If (VarType(strGroup) = vbError OR strGroup = "" ) Then
  161.          intReturnCode = intReturnCode + 8
  162.       End If
  163.       ' create path
  164.       strLDAPUsername = "LDAP://cn=" & strUsername & "," & strContainer
  165.       ' open connection to LDAP
  166.       Set adsNameSpace = GetObject("LDAP:" )
  167.       ' attempt to authenticate the user in the tree using the username and
  168.       ' the current password
  169.       Err.Clear
  170.       Set adsGroup = adsNamespace.OpenDSObject(                              _
  171.                                                CStr(strGroup)              , _
  172.                                                strUsername                 , _
  173.                                                strPassword                 , _
  174.                                                0                             _
  175.                                               )
  176.       If (Err = 0) Then
  177.          ' try if user is a member of the group
  178.          Err.Clear
  179.          If adsGroup.IsMember(strLDAPUsername) Then
  180.             ' reset previous errors if sucessfull
  181.             intReturnCode = 0
  182.          Else
  183.             intReturnCode = intReturnCode + 32
  184.          End If
  185.       Else
  186.          intReturnCode = intReturnCode + 16
  187.       End If
  188.      
  189.       ' return code
  190.       LDAPIsMember = intReturnCode
  191.    End Function


Message édité par Requin le 18-02-2004 à 16:04:46
n°1456622
chuckboy_0​1
Posté le 18-02-2004 à 16:08:00  profilanswer
 

Mais les password n'etais pas les meme que dans l'active directory ??
 

n°1456656
Requin
Posté le 18-02-2004 à 16:26:48  profilanswer
 

Si c'était bien le but d'unifier les comptes AD avec l'utilisation faite dans une application Web... et une des conditions c'est que les utilisateurs devaient depuis l'interface Web être en mesure de changer leur mot de passe dans AD.

n°1456664
chuckboy_0​1
Posté le 18-02-2004 à 16:29:39  profilanswer
 

Ok , je comprend , merci c genial ce truc !!!


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Windows & Software

  Authentification site web et active directory ??

 

Sujets relatifs
Aspirer un siteLe site www.commentcamarche.net n'existe plus ??
Un site à aller voirUn super site à aller voir
Impossible de RESUMER sur un site perso free ?Site pour envoyer des SMS gratuit depuis le net ??
Site leecher sympa ?site d'icônes sympas pour XP?
site errorplaceRecherche un bon aspirateur de site oueb
Plus de sujets relatifs à : Authentification site web et active directory ??


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR