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 Java Discussion :

Exception dans ACEGI Security


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre expérimenté Avatar de Pikwik
    Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    237
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2006
    Messages : 237
    Par défaut Exception dans ACEGI Security
    Je fais une WebApp avec spring et acegi...

    Tout fonctionne bien à une exception...

    Si je demande une page Interdite j'ai une exception levée...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    org.acegisecurity.AuthenticationCredentialsNotFoundException: 
    An Authentication object was not found in the SecurityContext
    Si je passe cette exception, tout fonctionne, mais ca me bloque mon appli...

    J'ai sans doute oublié un Bean de configuration... Mais comment faire ?


  2. #2
    Membre confirmé Avatar de tnodev
    Profil pro
    SSSSS
    Inscrit en
    Mai 2005
    Messages
    182
    Détails du profil
    Informations personnelles :
    Âge : 53
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : SSSSS

    Informations forums :
    Inscription : Mai 2005
    Messages : 182
    Par défaut
    La
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    org.acegisecurity.AuthenticationCredentialsNotFoundException
    est l'exception qui est levée lors d'un problémée d'authentification...

  3. #3
    Membre expérimenté Avatar de Pikwik
    Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    237
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2006
    Messages : 237
    Par défaut
    OK ca j'avais vu... Mais je ne sais pas comment faire pour qu'elle soit intercepté... j'ai beau tourné la chose dans tout les sens je trouve pas d'où cela peut venir...

    Le fichier context

    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
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
        "http://www.springframework.org/dtd/spring-beans.dtd">
     
     
    <beans default-lazy-init="true">
    	<bean id="filterChainProxy"
    		class="org.acegisecurity.util.FilterChainProxy">
    		<property name="filterInvocationDefinitionSource">
    			<value>
    				CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    				PATTERN_TYPE_APACHE_ANT
    				/**=httpSessionContextIntegrationFilter,basicProcessingFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,exceptionTranslationFilter,filterInvocationInterceptor
    			</value>
    		</property>
    	</bean>
     
       <bean id="basicProcessingFilter" class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">
          <property name="authenticationManager"><ref local="authenticationManager"/></property>
          <property name="authenticationEntryPoint"><ref local="basicProcessingFilterEntryPoint"/></property>
       </bean>
     
       <bean id="basicProcessingFilterEntryPoint" class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
          <property name="realmName"><value>Contacts Realm</value></property>
       </bean>
     
    	<bean id="httpSessionContextIntegrationFilter"
    		class="org.acegisecurity.context.HttpSessionContextIntegrationFilter" />
     
    	<bean id="logoutFilter"
    		class="org.acegisecurity.ui.logout.LogoutFilter">
    		<constructor-arg value="/index.jsp" />
    		<!-- URL redirected to after logout -->
    		<constructor-arg>
    			<list>
    				<bean
    					class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler" />
    			</list>
    		</constructor-arg>
     
    	</bean>
     
    	<bean id="securityContextHolderAwareRequestFilter"
    		class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter" />
     
    	<bean id="authenticationManager"
    		class="org.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    			<list>
    				<ref local="daoAuthenticationProvider" />
    			</list>
    		</property>
    		<property name="sessionController">
    			<ref bean="concurrentSessionController" />
    		</property>
    	</bean>
     
    	<bean id="concurrentSessionController"
    		class="org.acegisecurity.concurrent.ConcurrentSessionControllerImpl">
    		<property name="maximumSessions">
    			<value>1</value>
    		</property>
    		<property name="sessionRegistry">
    			<ref local="sessionRegistry" />
    		</property>
    	</bean>
     
    	<bean id="sessionRegistry"
    		class="org.acegisecurity.concurrent.SessionRegistryImpl" />
     
    	<bean id="exceptionTranslationFilter"
    		class="org.acegisecurity.ui.ExceptionTranslationFilter">
    		<property name="authenticationEntryPoint">
    			<ref local="authenticationProcessingFilterEntryPoint" />
    		</property>
    		<property name="accessDeniedHandler">
    			<bean
    				class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
    				<property name="errorPage" value="/index.jsp" />
    			</bean>
    		</property>
    	</bean>
     
    	<bean id="authenticationProcessingFilter"
    		class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
    		<property name="authenticationManager">
    			<ref bean="authenticationManager" />
    		</property>
    		<property name="authenticationFailureUrl">
    			<value>/index.jsp</value>
    		</property>
    		<property name="defaultTargetUrl">
    			<value>/prive/index.jsp</value>
    		</property>
    		<property name="filterProcessesUrl">
    			<value>/j_acegi_security_check</value>
    		</property>
    	</bean>
     
    	<bean id="authenticationProcessingFilterEntryPoint"
    		class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
    		<property name="loginFormUrl">
    			<value>/index.jsp</value>
    		</property>
    		<property name="forceHttps">
    			<value>false</value>
    		</property>
    	</bean>
     
    	<bean id="passwordEncoder"
    		class="org.acegisecurity.providers.encoding.PlaintextPasswordEncoder" />
     
    	<bean id="jdbcDao"
    		class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
    		<property name="usersByUsernameQuery">
    			<value>
    				select login,mot_de_passe,compte_active from utilisateur where login=?
    			</value>
    		</property>
    		<property name="authoritiesByUsernameQuery">
    			<value>
    				select login,droit from droit_utilisateur where login=?
    			</value>
    		</property>
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
    	<bean id="daoAuthenticationProvider"
    		class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
    		<!-- <property name="authenticationDao"><ref bean="jdbcDao"/></property> -->
    		<property name="userDetailsService">
    			<ref bean="jdbcDao" />
    		</property>
    		<property name="forcePrincipalAsString">
    			<value>false</value>
    		</property>
    		<property name="passwordEncoder">
    			<ref bean="passwordEncoder" />
    		</property>
    	</bean>
     
    	<bean id="filterInvocationInterceptor"
    		class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
    		<property name="authenticationManager">
    			<ref bean="authenticationManager" />
    		</property>
    		<property name="accessDecisionManager">
    			<ref bean="accessDecisionManager" />
    		</property>
    		<property name="runAsManager">
    			<ref bean="runAsManager" />
    		</property>
    		<property name="objectDefinitionSource">
    			<value>
    				CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    				PATTERN_TYPE_APACHE_ANT 
    				/prive/**=ROLE_ADMINISTRATEUR
    			</value>
    		</property>
    	</bean>
     
    	<bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter" />
     
    	<bean id="accessDecisionManager"
    		class="org.acegisecurity.vote.AffirmativeBased">
    		<property name="allowIfAllAbstainDecisions">
    			<value>false</value>
    		</property>
    		<property name="decisionVoters">
    			<list>
    				<ref bean="roleVoter" />
    			</list>
    		</property>
    	</bean>
     
    	<bean id="runAsManager"
    		class="org.acegisecurity.runas.RunAsManagerImpl">
    		<property name="key">
    			<value>my_run_as_password</value>
    		</property>
    	</bean>
     
    	<!-- <bean id="loggerListener" class="org.acegisecurity.event.authentication.LoggerListener"/> -->
    	<bean id="loggerListener" class="com.myapp.celena.acegi.LoggerListener">
    		<property name="utilisateurManager"><ref bean="utilisateurManager"/></property>
    	</bean>
     
    </beans>

  4. #4
    Membre confirmé Avatar de tnodev
    Profil pro
    SSSSS
    Inscrit en
    Mai 2005
    Messages
    182
    Détails du profil
    Informations personnelles :
    Âge : 53
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : SSSSS

    Informations forums :
    Inscription : Mai 2005
    Messages : 182
    Par défaut
    L'interception des erreurs, je les gére au niveau du web.xml et je n'ai pas autant de filter au niveau d'Acegi.

    Sinon, essaye de voir avec les logs d'Acegi qui sont très bien fait et très clair...

  5. #5
    Candidat au Club
    Inscrit en
    Mars 2005
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 4
    Par défaut
    Si l’exeption AuthenticationException est rejetée, c’est qu’il n’existe pas d’objet Authentication dans votre SecurityContext.
    Jetez un coup d’œil sur le liens suivant, je crois que ça correspond à voter problème :
    http://forum.springframework.org/sho...FoundException
    J’espère que ça aide :-)

Discussions similaires

  1. [VC6 et MFC] Exception dans MFC42D.dll
    Par Philippe320 dans le forum MFC
    Réponses: 8
    Dernier message: 09/12/2005, 14h14
  2. exception dans un constructeur
    Par xxiemeciel dans le forum C++
    Réponses: 25
    Dernier message: 23/11/2005, 18h14
  3. gestionnaire d'Exception dans DLL
    Par pirbd dans le forum Langage
    Réponses: 2
    Dernier message: 03/03/2005, 18h58
  4. Capture d'exception dans un constructeur
    Par declencher dans le forum Composants VCL
    Réponses: 8
    Dernier message: 03/02/2004, 12h52
  5. Réponses: 2
    Dernier message: 28/08/2003, 00h00

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