Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

18.9. Configurer SPNEGO avec un renvoi à l'authentification Form

Suivre la procédure ci-dessous pour configurer un SPNEGO avec un renvoi à l'authentification Form.

Procédure 18.2. Sécurité SPNEGO avec renvoi à l'authentification Form

  1. Configurer SPNEGO

  2. Modifier le fichier web.xml

    Ajouter un élément login-config à votre application et configurer les pages de connexion et d'erreurs dans le fichier web.xml  :
    <login-config>
        <auth-method>SPNEGO</auth-method>
        <realm-name>SPNEGO</realm-name>
            <form-login-config>
                <form-login-page>/login.jsp</form-login-page>
                <form-error-page>/error.jsp</form-error-page>
            </form-login-config>
       </login-config>
    
  3. Ajouter un contenu web

    Ajouter des references de login.html et de error.html à web.xml. Ces fichiers sont ajoutés à l'archive d'application web à l'emplacement spécifié dans la configuration form-login-config. Pour obtenir des informations, voir la section Enable Form-based Authentication du Security Guide de JBoss EAP 6. Un fichier login.html typique ressemble à ceci :
    <html>
        <head>
            <title>Vault Form Authentication</title>
        </head>
        <body>
            <h1>Vault Login Page</h1>
            <p>   
            <form method="post" action="j_security_check">
            <table>
                <tr>
                    <td>Username</td><td>-</td>
                    <td><input type="text" name="j_username"></td>
                </tr>
                <tr>
                    <td>Password</td><td>-</td>
                    <td><input type="password" name="j_password"></td>
                </tr>
                <tr>
                    <td colspan="2"><input type="submit"></td>
                </tr>              
            </table>
            </form>
            </p> 
            <hr>
        </body>
    </html>
    

Note

Le renvoi à la logique FORM n'est disponible que dans le cas où il n'y a pas de SPNEGO (ni de NTLM). De ce fait, un formulaire de connexion n'est pas présenté au navigateur si le navigateur envoie un token NTLM.