Hello,
J'utilise JGuard0.80final avec JBoss4.03...
J'ai un petit probleme avec l'utilisation de jguard (j'ai bien reussi a faire marcher l'exemple fournit dans l'archive), cependant je n'arrive pas a acceder aux differentes pages que j'ai crée en m'inspirant de leur exemple...
Je peux me connecter mais meme en etant connecté les seuls pages auquel j'accede sont access denied, logon, logoff, authorization failed...
Voici mes fichiers de config :
web.xml :
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 <web-app> <display-name>test</display-name> <filter> <filter-name>AccessFilter</filter-name> <description>access filter</description> <filter-class>net.sf.jguard.authentication.http.AccessFilter</filter-class> <init-param> <param-name>configurationLocation</param-name> <param-value>/WEB-INF/conf/jGuard/jGuardConfiguration.xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>AccessFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <listener> <listener-class>net.sf.jguard.listeners.SessionListener</listener-class> </listener> <listener> <listener-class>net.sf.jguard.listeners.ContextListener</listener-class> </listener> <session-config> <session-timeout>30</session-timeout> </session-config> <!-- The Usual Welcome File List --> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>action</servlet-name> <description>jGuardExample struts servlet</description> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/conf/struts/struts-config.xml</param-value> <description>general module</description> </init-param> <init-param> <param-name>locale</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>convertNull</param-name> <param-value>true</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Standard Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <taglib> <taglib-uri>/tags/struts/html</taglib-uri> <taglib-location>/WEB-INF/conf/tld/struts-html.tld</taglib-location> </taglib>
jGuardPrincipalPermissions.xml :
jGuardConfiguration.xml :
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84 <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <!DOCTYPE configuration SYSTEM "jGuardPrincipalsPermissions_0.80.dtd"> <configuration> <permissions> <domain> <name>public</name> <permission> <name>accessDenied</name> <class>net.sf.jguard.authorization.permissions.URLPermission</class> <actions> <action>/AccessDenied.do</action> <action>http</action> <action>ressource where you are redirected when access to another ressource is denied</action> </actions> </permission> <permission> <name>accueil</name> <class>net.sf.jguard.authorization.permissions.URLPermission</class> <actions> <action>/Welcome.do</action> </actions> </permission> <permission> <name>registration</name> <class>net.sf.jguard.authorization.permissions.URLPermission</class> <actions> <action>/Registration.do</action> </actions> </permission> <permission> <name>registrationProcess</name> <class>net.sf.jguard.authorization.permissions.URLPermission</class> <actions> <action>/RegistrationProcess.do</action> </actions> </permission> </domain> <domain> <name>vip</name> <permission> <name>allAccess</name> <class>net.sf.jguard.authorization.permissions.URLPermission</class> <actions> <action>/*</action> <action>full access to any ressource</action> </actions> </permission> </domain> </permissions> <principals> <principal> <name>guest</name> <class>net.sf.jguard.principals.JGuardPrincipal</class> <permissionsRef> <permissionRef name="accessDenied"/> <permissionRef name="accueil"/> <permissionRef name="registration"/> <permissionRef name="registrationProcess"/> </permissionsRef> </principal> <principal> <name>other</name> <class>net.sf.jguard.principals.JGuardPrincipal</class> <permissionsRef/> </principal> <principal> <name>admin</name> <class>net.sf.jguard.principals.JGuardPrincipal</class> <permissionsRef> <domainRef name="public"/> <domainRef name="vip"/> </permissionsRef> <descendants> <principalRef name="other"/> </descendants> </principal> </principals> </configuration>
jGuardUsersPrincipals.xml :
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <!DOCTYPE configuration SYSTEM "jGuardConfiguration_0.80.dtd"> <configuration> <authentication> <!-- boolean option('true' or 'false'), to activate the authorization debug mode --> <debug>true</debug> <!-- Index uri of your web application. --> <indexURI>/index.jsp</indexURI> <!-- Uri when the user authentication failed. --> <authenticationFailedURI>/AuthenticationFailed.do</authenticationFailedURI> <!-- Uri to access to the authentication form --> <logonURI>/Logon.do</logonURI> <!-- uri to be authenticated. The action property of the authentication form MUST NOT be set to j_security_check. --> <logonProcessURI>/LogonProcess.do</logonProcessURI> <registerURI>/Registration.do</registerURI> <registerProcessURI>/RegistrationProcess.do</registerProcessURI> <!-- uri to to be unauthenticated --> <logoffURI>/Logoff.do</logoffURI> <!-- uri when access to a ressource is denied --> <accessDeniedURI>/AccessDenied.do</accessDeniedURI> <authScheme>FORM</authScheme> <loginField>login</loginField> <!-- Parameter's name of the form's field which holds the password. All values are accepted except j_password. --> <passwordField>password</passwordField> <includeOldConfig>false</includeOldConfig> <!-- java.security.auth.login.config --> <includeConfigFromJavaParam>false</includeConfigFromJavaParam> <includePolicyFromJavaParam>false</includePolicyFromJavaParam> <!-- <digestAlgorithm>MD5</digestAlgorithm> --> <!-- <salt>qsd846sdq6ds4</salt> --> <authenticationManager>net.sf.jguard.authentication.XmlAuthenticationManager</authenticationManager> <authenticationManagerOptions> <option> <name>authenticationXmlFileLocation</name> <value>WEB-INF/conf/jGuard/jGuardUsersPrincipals.xml</value> </option> </authenticationManagerOptions> <loginModules> <!-- specify which loginModules are used for authentication. --> <loginModule> <name>net.sf.jguard.authentication.loginmodules.XmlLoginModule</name> <!-- flag :'REQUIRED','OPTIONAL','REQUISITE' or 'SUFFICIENT' --> <flag>REQUIRED</flag> <loginModuleOptions> <option> <name>debug</name> <value>true</value> </option> </loginModuleOptions> </loginModule> </loginModules> </authentication> <authorization> <authorizationManager>net.sf.jguard.authorization.XmlAuthorizationManager</authorizationManager> <authorizationManagerOptions> <option> <name>authorizationXmlFileLocation</name> <value>WEB-INF/conf/jGuard/jGuardPrincipalsPermissions.xml</value> </option> <option> <name>debug</name> <value>true</value> </option> </authorizationManagerOptions> </authorization> </configuration>
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94 <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <!DOCTYPE usersPrincipals SYSTEM "jGuardUsersPrincipals_0.80.dtd"> <usersPrincipals> <principals> <principal> <name>admin</name> <class>net.sf.jguard.principals.JGuardPrincipal</class> <applicationName>test</applicationName> </principal> <principal> <name>guest</name> <class>net.sf.jguard.principals.JGuardPrincipal</class> <applicationName>test</applicationName> </principal> <principal> <name>role3</name> <class>net.sf.jguard.principals.JGuardPrincipal</class> <applicationName>anotherApplication</applicationName> </principal> </principals> <users> <userTemplate> <name>default</name> <privateRequiredCredentials> <credTemplateId identity="true">login</credTemplateId> <credTemplateId digestNeeded="true">password</credTemplateId> </privateRequiredCredentials> <publicRequiredCredentials> <credTemplateId>firstname</credTemplateId> <credTemplateId>lastname</credTemplateId> <credTemplateId>location</credTemplateId> </publicRequiredCredentials> <privateOptionalCredentials> <credTemplateId>country</credTemplateId> <credTemplateId>religion</credTemplateId> </privateOptionalCredentials> <publicOptionalCredentials> <credTemplateId>hobbies</credTemplateId> </publicOptionalCredentials> <genericPrincipals> <principalRef name="admin" applicationName="test"/> </genericPrincipals> <specificPrincipalFactories/> </userTemplate> <user> <privateCredentials> <credential> <id>login</id> <value>admin</value> </credential> <credential> <id>password</id> <value>admin</value> </credential> </privateCredentials> <publicCredentials> <credential> <id>firstname</id> <value>Rick</value> </credential> <credential> <id>lastname</id> <value>Dangerous</value> </credential> <credential> <id>location</id> <value>Paris</value> </credential> </publicCredentials> <principalsRef> <principalRef name="admin" applicationName="test" /> </principalsRef> </user> <user> <privateCredentials> <credential> <id>login</id> <value>guest</value> </credential> <credential> <id>password</id> <value>guest</value> </credential> </privateCredentials> <publicCredentials/> <principalsRef> <principalRef name="guest" applicationName="test" /> </principalsRef> </user> </users> </usersPrincipals>
Voila je comprends pas trop pourquoi ca ne marche pas mais en tout cas je suis loggé car sur la console il me marque bien que je suis loggé en tant qu'admin...
Merci pour votre aide,
Jérémy
P.S: l'application se nomme test et se trouve dans /jboss/server/default/deploy/test.war ( http://localhost:8080/test)
Partager