dlarosa11 Posted May 13, 2008 Share Posted May 13, 2008 Hello out there. I've been banging my head for a couple of days and have no more obvious (or not so obvious) strategies for getting JasperServer to use my Jaas classes to authenticate. The authenticate actually works fine, but I choke when trying to grant authority.[p]I am looking for a working example of a JaasAuthentication provider with a home-spun AuthorityGranter. The only example I've found is the TestAuthorityGranter class, but I don't see it all rolled up in a working applicationContext-security.xml file. [p]I've created a class that implements the acegi AuthorityGranter interface, but when JBoss tries to create the bean from my applicationSContext-security.xml file, I'm getting the following exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ptiJaasAuthenticationProvider' defined in ServletContext resource [/WEB-INF/applicationContext-security.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [org.acegisecurity.providers.jaas.AuthorityGranter[]] for property 'authorityGranters'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.perimeter.authentication.PtiAuthorityGranter] to required type [org.acegisecurity.providers.jaas.AuthorityGranter] for property 'authorityGranters[0]': no matching editors or conversion strategy foundCaused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:PropertyAccessException 1:org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [org.acegisecurity.providers.jaas.AuthorityGranter[]] for property 'authorityGranters'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.perimeter.authentication.PtiAuthorityGranter] to required type [org.acegisecurity.providers.jaas.AuthorityGranter] for property 'authorityGranters[0]': no matching editors or conversion strategy foundCaused by: java.lang.IllegalArgumentException: Cannot convert value of type [com.perimeter.authentication.PtiAuthorityGranter] to required type [org.acegisecurity.providers.jaas.AuthorityGranter] for property 'authorityGranters[0]': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:224) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:124) at org.springframework.beans.TypeConverterDelegate.convertToTypedArray(TypeConverterDelegate.java:282) Here is my AuthorityGranter: Code:public class PtiAuthorityGranter implements org.acegisecurity.providers.jaas.AuthorityGranter{ public Set grant(Principal principal) { Set rtnSet = new HashSet(); // just add administrator right off the bat for now // TODO: check database for permissions and add appropriate ones rtnSet.add("ROLE_ADMINISTRATOR"«»); // if (principal.getName().equals("TEST_PRINCIPAL"«»)) { // rtnSet.add("ROLE_TEST1"«»); // rtnSet.add("ROLE_TEST2"«»); // } return rtnSet; }} Here's a snippet from my applicationContext-security.xml Code:[code]<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <!-- here is the list of authentication mechanisms --> <ref local="ptiJaasAuthenticationProvider"/> </list> </property> </bean> <bean id="ptiJaasAuthenticationProvider" class="org.acegisecurity.providers.jaas.JaasAuthenticationProvider"> <!-- TODO: we don't actually want to look here, we should look in server/default/conf/login-conf.xml for jboss --> <property name="loginConfig"> <value>/WEB-INF/login.conf</value> </property> <property name="loginContextName"> <value>RealtimeAppDb</value> </property> <property name="callbackHandlers"> <list> <bean class="org.acegisecurity.providers.jaas.JaasNameCallbackHandler"/> <bean class="org.acegisecurity.providers.jaas.JaasPasswordCallbackHandler"/> </list> </property> <property name="authorityGranters"> <list> <bean class="com.perimeter.authentication.PtiAuthorityGranter"/> </list> </property> </bean> Any help, of course, is greatly appreciated. Domenic Link to comment Share on other sites More sharing options...
swood Posted May 27, 2008 Share Posted May 27, 2008 The class and configuration look fine. I hate to seem basic about it, but is your class in the WEB-INF/lib? Does the package name in the config match what is defined for the class? ShermanJasperSoft Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now