JasperServer Token Based Authentication 404 Error

0

I created a user with username tokenUser and I want to be able to authenticate him with just his username; that is, I want the URL "http://localhost:8080/jasperserver?pp=u=tokenUser" to log him in.

I edited the sample-applicationContext-externalAuth-preAuth xml file so that the preAuthenticatedManager bean looks like:

<bean id="preAuthenticatedManager" class="com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.JSProviderManager">
        <property name="providers">
            <list>
                <!-- This bean calls upon preAuthenticatedUserDetailsService to create user details based on
                 a token extracted from request by proxyPreAuthenticatedProcessingFilter -->
                <bean class="com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.preauth.JSPreAuthenticatedAuthenticationProvider">
                    <property name="preAuthenticatedUserDetailsService">
                        <bean class="com.jaspersoft.jasperserver.api.security.externalAuth.preauth.JSPreAuthenticatedUserDetailsService">
                            <!-- Token format configuration example for token: u=obama|r=PRESIDENT,HUSBAND|pa1=USA,Kenya|pa2=Washington -->
                            <property name="tokenPairSeparator" value="|"/>
                            <property name="tokenFormatMapping">
                                <map>
                                    <entry key="username" value="u" />
                                </map>
                            </property>
                            <property name="tokenExpireTimestampFormat" value="yyyyMMddHHmmssZ"/>
                        </bean>
                    </property>
                </bean>
            </list>
        </property>
    </bean>

I did not edit anything else in the xml file. Then I renamed it as applicationContext-externalAuth-preAuth and put it in "C:\Jaspersoft\jasperreports-server-cp-7.1.0\apache-tomcat\webapps\jasperserver\WEB-INF".

After restarting JasperServer, the URL "http://localhost:8080/jasperserver?pp=u=tokenUser" gives me a 404 error. I also tried "http://localhost:8080/jasperserver?pp=u%3DtokenUser" and "http://localhost:8080/jasperserver?pp%3Du%3DtokenUser" and also simply "http://localhost:8080/jasperserver"; they all give me the 404 error. I also tried tokens with the default users that come with JasperServer and they also don't work.

As soon as I delete the preAuth xml file in WEB-INF and restart the server, everything works again (no 404 when I navigate to "http://localhost:8080/jasperserver").

Any ideas?

tchen_1's picture
17
Joined: May 18 2018 - 9:24am
Last seen: 1 year 3 months ago

I am getting this exact error. Did you ever figure out the cause of this?

john_71 - 7 months 3 weeks ago

0 Answers:

No answers yet
Feedback
randomness