Salut,
Voila j'aimerais securiser l'access directement à mes pages jsf. j'ai créé un projet jsf sous netbeans/tomcat6 :
ma page de login est comme ceci :
sur le net je suis tombé sur http://benjaminprevot.fr/2010/07/14/...-pas-avec-jsf/
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 <h:form> <table> <tr> <td><h:outputText value="Enter Login ID: " /></td> <td><h:inputText id="loginname" value="#{SimpleLogin.loginname}" required="true" > <f:validateLength maximum="5" minimum="4"/> </h:inputText> <font color="#FF0000"> <h:message for="loginname"/></font></td> </tr> <tr> <td><h:outputText value="Enter Password: " /></td> <td><h:inputSecret id="password" value="#{SimpleLogin.pass}" required="true" /> <font color="#FF0000"><h:message for="password" /></font></td> </tr> <tr> <td> </td> <td><h:commandButton value="Login" action="#{SimpleLogin.CheckValidUser}" /></td> </tr> </table> </h:form>
proposant d'ajouterdans mon web.xml mais aucun success
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <security-constraint> <web-resource-collection> <web-resource-name>no-jsp-access</web-resource-name> <url-pattern>*.jsp</url-pattern> </web-resource-collection> <auth-constraint> <description>No direct access to JSP</description> </auth-constraint> </security-constraint>
voici mon faces config
Merci
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 <managed-bean> <managed-bean-name>SimpleLogin</managed-bean-name> <managed-bean-class>control.SimpleLogin</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <navigation-rule> <from-view-id>/welcomeJSF.jsp</from-view-id> <navigation-case> <from-outcome>success</from-outcome> <to-view-id>/resultforsuccess.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>fail</from-outcome> <to-view-id>/resultforfail.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config>
Partager