2011-11-17 78 views
0

我必須連接到獲得授權的第三方工具,該工具稱爲我的客戶使用的超人。不確定這是內部還是購買。我使用Spring安全進行身份驗證,通過向JDBC服務提供外部查詢來完成用戶。當執行特定於該工具的授權查詢,我得到以下錯誤:授權查詢結果集無效

"Authentication event AuthenticationFailureServiceExceptionEvent: liseol; 
details: null; 
exception: PreparedStatementCallback; 
invalid ResultSet access for SQL [SELECT id_fonction_if AS functions 
FROM superman.AUTORISATIONS, superman.INCLUS_FONCTIONS 
WHERE id_grp_de_fonctions_a=id_grp_de_fonctions_if 
AND id_domaine_if =id_domaine_a 
AND id_application_if =id_application_a 
AND id_domaine_a ='SI' 
AND id_application_a ='PAN' 
AND no_emp_a =(select emp_no from sigsi.employes 
where upper(emp_logon)= upper(?))]; 
nested exception is java.sql.SQLException: 
Index de colonne non valide" (Column index is invalid). 

下面是我的安全配置文件的詳細信息

</security:global-method-security> 

<security:http auto-config="true"> 
    <security:intercept-url pattern="PanierSIG.html"/> 
    <security:intercept-url pattern="/**/*.swf"/> 
    <security:intercept-url pattern="/**" /> 
</security:http> 



<security:authentication-manager alias="_authenticationManager"> 
    <security:authentication-provider> 
     <security:password-encoder hash="plaintext"/> 
     <security:jdbc-user-service data-source-ref="dataSource" 
         users-by-username-query="select LOGON,PASSWORD,CATALOGUE from sigpan.UTILISATEURS where LOGON = ?" 
         authorities-by-username-query="SELECT id_fonction_if AS functions 
         FROM superman.AUTORISATIONS, superman.INCLUS_FONCTIONS 
         WHERE id_grp_de_fonctions_a=id_grp_de_fonctions_if 
         AND id_domaine_if   =id_domaine_a 
         AND id_application_if  =id_application_a 
         AND id_domaine_a   ='SI' 
         AND id_application_a  ='PAN' 
         AND no_emp_a =(select emp_no from sigsi.employes where upper(emp_logon)= upper(?))"/> 

         <!-- 
         group-authorities-by-username-query="select g.id, g.group_name, ga.authority from groups g, group_members gm, group_authorities ga where gm.username = ? and g.id = ga.group_id and g.id = gm.group_id" 
         --> 
    </security:authentication-provider> 
</security:authentication-manager> 

<!-- Automatically receives AuthenticationEvent messages --> 
<bean id="loggerListener" class="org.springframework.security.authentication.event.LoggerListener"/> 

我想,我的項目是基於柔性的Java添加。 Flex 4,Java 5,Spring 3.0.5。 Release和Spring Secuirty 3.1.0.M1。

回答

0

「列索引無效」與JDDC ResultSet上的IndexOutOfBoundsException類似。春季框架顯然希望你的權限 - 通過用戶名查詢返回多個列。我不熟悉Spring框架,但是在基於JAAS的JBOSSAS內置安全性中,看起來與上面的操作非常相似,您將不得不添加一個「角色」列。

SELECT id_fonction_if AS functions, 'Roles' 
         FROM superman.AUTORISATIONS, superman.INCLUS_FONCTIONS 
         WHERE id_grp_de_fonctions_a=id_grp_de_fonctions_if 
         AND id_domaine_if   =id_domaine_a 
         AND id_application_if  =id_application_a 
         AND id_domaine_a   ='SI' 
         AND id_application_a  ='PAN' 
         AND no_emp_a =(select emp_no from sigsi.employes where upper(emp_logon)= upper(?))