IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Web Java Discussion :

spring security login.xhtml appeler j_spring_security_check [JSF]


Sujet :

Spring Web Java

  1. #1
    Membre éprouvé Avatar de Bubu017
    Homme Profil pro
    Ingénieur validation
    Inscrit en
    Avril 2008
    Messages
    300
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Deux Sèvres (Poitou Charente)

    Informations professionnelles :
    Activité : Ingénieur validation
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2008
    Messages : 300
    Points : 1 003
    Points
    1 003
    Par défaut spring security login.xhtml appeler j_spring_security_check
    Bonjour à tous, je met cette question ici car ça touche surtout Spring mais si ça concerne plus jsf dites le moi.

    Voilà j'essaye de fiare fonctionner tout ce petit monde ensmeble : jsf + richfaces+ spring webflow + spring security.

    Je suis sur SPring Security et je veux faire ma propre fenêtre de log vu que celle par défaut est légérement horrible. Le truc c'est que je ne veux pas mettre une jsp mais une xhtml et profiter de richfaces.

    Mon problème est que je ne peux pas mettre de form dans ma page et donc ne pas faire : <form action="j_spring_security_check" car sinon je n'ai aps droit à la vérif des champs richfaces

    Si vous pouviez me dire comment je peux appeler cette action avec la page suivante ce serait achement sympa :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    <?xml version="1.0" encoding="UTF-8" ?>
    <!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"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
    	xmlns:h="http://java.sun.com/jsf/html"
    	xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:a4j="http://richfaces.org/a4j"
    	xmlns:rich="http://richfaces.org/rich"
    	xmlns:sf="http://www.springframework.org/tags/faces">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Identification</title>
    </head>
    <body style="width: 290px; margin: auto; background-color: #D9D3D3">
    <f:view>
    	<h:form>
    					<rich:spacer height="200px"></rich:spacer>
    			<rich:panel header="Identification"
    				style="background-image:url(#{facesContext.externalContext.requestContextPath}/images/logoIdent.jpg); 
    				background-position:0px 40px;background-repeat:no-repeat;width: 290px; height:140px">
    				<h:panelGrid columns="2">
     
    					<h:outputText value="Login:" style="font-weight: bold" />
    					<h:inputText id="j_username" value="" required="true"
    						requiredMessage="Le login est obligatoire" />
    					<h:outputText value="Mot de passe :" style="font-weight: bold" />
    					<h:inputSecret id="j_password" value="" required="true"
    						requiredMessage="Le mot de passe est obligatoire" />
    				</h:panelGrid>
    				<rich:spacer height="30px"></rich:spacer>
    				<a4j:commandButton value="Connexion" type="submit" />
    			</rich:panel>
    			<h:panelGrid columns="1">
    				<rich:message for="j_username" style="color: red;font-size: large" />
    				<rich:message for="j_password" style="color: red;font-size: large" />
    			</h:panelGrid>
    	</h:form>
    </f:view>
    </body>
    </html>
    Je ne sais pas si je suis clair, mias si vous ne comprenez pas, dites le moi

  2. #2
    Membre actif Avatar de amadoulamine1
    Inscrit en
    Avril 2005
    Messages
    260
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 260
    Points : 270
    Points
    270
    Par défaut
    Salut tu devrai mettre ceci dans ton fichier de config spring security pour le parametrage de l'interception du login
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <form-login login-processing-url="/j_spring_security_check" login-page="/authentification/login.jsf" default-target-url="/"/>
    puis mettre un loginBean, si tu le souhaites un listener ...
    enfin tout ce beau monde a été explique plus en détail ici

    En esperant t'avoir aidé !!!
    Bonne chance pour la suite

  3. #3
    Membre éprouvé Avatar de Bubu017
    Homme Profil pro
    Ingénieur validation
    Inscrit en
    Avril 2008
    Messages
    300
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Deux Sèvres (Poitou Charente)

    Informations professionnelles :
    Activité : Ingénieur validation
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2008
    Messages : 300
    Points : 1 003
    Points
    1 003
    Par défaut
    Ok cool merci, en ce moment je suis reparti sur de la modélisation docn je testerais ça plus tard mais ça a l'air de marcher.
    Sinon j'avias un peu bidouiller ma page login.xhtml pour que ça marche. Le truc qui me dérangeait le plus enf ait c'était de ne pas avoir la vérification automatique des champs (le required true) mais j'ai réussi à l'avoir avec d'autres balises.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    <?xml version="1.0" encoding="UTF-8" ?>
    <!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"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
    	xmlns:h="http://java.sun.com/jsf/html"
    	xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:a4j="http://richfaces.org/a4j"
    	xmlns:rich="http://richfaces.org/rich"
    	xmlns:sf="http://www.springframework.org/tags/faces">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Identification</title>
    </head>
    <body style="width: 290px; margin: auto; background-color: #D9D3D3">
    <f:view>
    	<!--	<h:form>-->
    	<form action="j_spring_security_check" method="post">
    	<h:messages />
    	<rich:spacer height="200px"></rich:spacer>
    	<rich:panel header="Identification"
    		style="background-image:url(#{facesContext.externalContext.requestContextPath}/images/logoIdent.jpg); 
    				background-position:0px 40px;background-repeat:no-repeat;width: 290px; height:140px">
    		<h:panelGrid columns="2">
     
    			<h:outputText value="Login:" style="font-weight: bold" />
    			<sf:clientTextValidator required="true">
    				<h:inputText id="j_username" value=""/>
    			</sf:clientTextValidator>
     
    			<h:outputText value="Mot de passe :" style="font-weight: bold" />
    			<sf:clientTextValidator required="true">
    				<h:inputSecret id="j_password" value=""/>
    			</sf:clientTextValidator>
    		</h:panelGrid>
    		<rich:spacer height="30px"></rich:spacer>
    		<!--			<a4j:commandButton value="Connexion" type="submit" action="/j_spring_security_check"/>-->
    		<input type="submit" value="Valider" />
    	</rich:panel>
    	</form>
    	<!--	</h:form>-->
    </f:view>
    </body>
    </html>

  4. #4
    Membre actif Avatar de amadoulamine1
    Inscrit en
    Avril 2005
    Messages
    260
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 260
    Points : 270
    Points
    270
    Par défaut
    essaie plutot de mettre les required dans les inputText genre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <h:inputText id="j_username" required="true" />

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Security] Spring security login.htm?
    Par Logic_613 dans le forum Spring
    Réponses: 1
    Dernier message: 28/11/2012, 17h05
  2. Réponses: 2
    Dernier message: 02/07/2011, 12h34
  3. [Security] Spring security - Login after logout
    Par duff01 dans le forum Spring
    Réponses: 1
    Dernier message: 30/07/2010, 13h29
  4. Spring Security Login Role
    Par g25452 dans le forum Spring
    Réponses: 0
    Dernier message: 12/05/2009, 14h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo