Jump to content
We've recently updated our Privacy Statement, available here ×

Cannot create inner bean 'com.jaspersoft.jasperserver.api.common.crypto.DevelopmentPlainTextNonCipher


joseng62

Recommended Posts

When beginning to test and work on token authentication there is an sample file in jasperreports-server-cp-7.1.0-bin.zip called "sample-applicationContext-externalAuth-preAuth.xml"

The first easy obvious step would be to test how all of this works and a none encoded string token would be easiest to make use of to test the whole process. In some example on the internet reference is made in testing via url with un encoded string token. 
Inside the above file there is a bean that points to a class → <bean class="com.jaspersoft.jasperserver.api.common.crypto.DevelopmentPlainTextNonCipher"/> 
Still should allow to test token with string as is, but error is occured when following the steps as per example to test this and restarting the JasperServer.

Kind Regards
Josia

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Seems that the given class was renamed or the name stipulated in the sample file is incorrect.
The "Development" part should be removed in the class name.
For Jasper 7.1 use:
<bean class="com.jaspersoft.jasperserver.api.common.crypto.DevelopmentPlainTextNonCipher"/>
Before Jasper 7.1 use:
<bean class="com.jaspersoft.jasperserver.api.common.crypto.PlainTextNonCipher"/>

Restart and now you can test plan string through url.

Link to comment
Share on other sites

Different issues after above applied : 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.preauth.JSPreAuthenticatedAuthenticationProvider#4266ed52' defined in ServletContext resource [/WEB-INF/applicationContext-externalAuth-preAuth.xml]: Cannot create inner bean 'com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService#12eeb363' of type [com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService] while setting bean property 'preAuthenticatedUserDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService#12eeb363' defined in ServletContext resource [/WEB-INF/applicationContext-externalAuth-preAuth.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: orgId must be mapped in tokenFormatMapping
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:287)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276)
        ... 68 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService#12eeb363' defined in ServletContext resource [/WEB-INF/applicationContext-externalAuth-preAuth.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: orgId must be mapped in tokenFormatMapping
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276)
        ... 74 more
Caused by: java.lang.IllegalArgumentException: orgId must be mapped in tokenFormatMapping
        at org.springframework.util.Assert.isTrue(Assert.java:65)
        at com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService.afterPropertiesSet(JSPreAuthenticatedUserDetailsService.java:85)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
        ... 77 more

Link to comment
Share on other sites

In the applicationContext-externalAuth-preAuth.xml file I had to add <entry key="orgId" value="o" /> under tag 
    <bean id="preAuthenticatedManager" class="com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.JSProviderManager">
        <property name="providers"> 
along with the <entry key="username" value="u" /> and other entries.

So as I understand it that orgId should not be rquired for the Community Edition of Jasper, but i looked into one of the classes 
<bean class="com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService">
and in the code there is an assert test for orgId, so it seem this is required. 

 public void afterPropertiesSet()
    throws Exception
  {
    Assert.isTrue(this.tokenFormatMapping.containsKey("username"), "username must be mapped in tokenFormatMapping");
    Assert.isTrue(this.tokenFormatMapping.containsKey("roles"), "roles must be mapped in tokenFormatMapping");
    Assert.isTrue(this.tokenFormatMapping.containsKey("orgId"), "orgId must be mapped in tokenFormatMapping");
  }
  
So after adding the above entry into the given .xml file, jasper server started up without any issues. 
No i need to test the string token, hope it works as orgId might cause issues as it should not be required for Jasper Communiy Edition 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...