Bonjour
Je cherche à sécuriser l'accès à une application, grâce à Spring Security, de telle sorte qu'une partie de l'appli soit accessible via une authentification par certificat (type X509) et une autre partie via une authentification basique.
Pour cela j'ai intégré 2 balise <http> à ma configuration Spring, ainsi :
Mon problème est le suivant : les 2 modes d'authentification fonctionnent bien indépendamment l'un de l'autre (c'est à dire si je n'en renseigne qu'un dans ma conf) mais dès lors que je renseigne les 2 seule la conf basic auth est prise en compte et régit les accès à toutes les URLs, y compris celle correspondant au pattern "/main/**fix*" .
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 <!-- Web security --> <authentication-manager> <authentication-provider ref="ldapAuthenticationProvider" /> </authentication-manager> <beans:bean id="authService" class="com.security.ldap.userDetailsService"> <beans:property name="config"> <beans:ref bean="daoAuthenticationProviderConfig" /> </beans:property> </beans:bean> <http auto-config='false' pattern="/main/**fix*" use-expressions="true"> <access-denied-handler error-page="/forbidden"/> <x509 subject-principal-regex="UID=(.*?),.*" user-service-ref="authService"/> <intercept-url pattern="/main/**fix*" access="hasRole('ROLE_USER')" /> </http> <http auto-config='false' pattern="/**" use-expressions="true"> <access-denied-handler error-page="/forbidden"/> <http-basic /> <intercept-url pattern="/**" access="hasRole('ROLE_USER')" /> </http>
Manque-t-il quelque chose à ma configuration pour permettre les 2 modes d'authentification de coexister?
Merci
Partager