Jump to content
JasperReports Library 7.0 is now available ×

Implementing a custom authentication filter and error handling


Recommended Posts


I have introduced a filter to do some internal SSO authentication which is working fine. This filter is required to print a custom message on failure for which I have a failure URL. The bean is:


This filter is doing a redirect like httpResponse.sendRedirect(httpResponse.encodeRedirectURL("/jasperserver/sso_error.html"));

I have added /sso_error.html in applicationContext-security-web.xml's bean filterInvocationInterceptor to force anonymous resource something like below:

	        	        	        	        	            	                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON	                PATTERN_TYPE_APACHE_ANT	                /login.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR	                /logout.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR,IS_AUTHENTICATED_FULLY	                /loginerror.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR	                /error.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR	                /sso_error.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR	                /exituser.html=ROLE_ANONYMOUS,ROLE_USER,ROLE_ADMINISTRATOR,IS_AUTHENTICATED_FULLY	                /home.html=ROLE_USER,ROLE_ADMINISTRATOR	                /flow.html=ROLE_USER,ROLE_ADMINISTRATOR	                /loginsuccess.html=ROLE_USER,ROLE_ADMINISTRATOR	                /listolapviews.html=ROLE_USER,ROLE_ADMINISTRATOR	                /fillparams.html=ROLE_USER,ROLE_ADMINISTRATOR	                /j_spring_switch_user*=ROLE_ADMINISTRATOR	                /fileview/**=ROLE_USER,ROLE_ADMINISTRATOR	                /olap/**=ROLE_USER,ROLE_ADMINISTRATOR	                /xmla=ROLE_USER,ROLE_ADMINISTRATOR	                /services/**=ROLE_USER,ROLE_ADMINISTRATOR	                /reportimage/**=ROLE_USER,ROLE_ADMINISTRATOR	                /jrpxml/**=ROLE_USER,ROLE_ADMINISTRATOR	                /heartbeatinfo.html=ROLE_USER,ROLE_ADMINISTRATOR	                /rest/**=ROLE_USER,ROLE_ADMINISTRATOR	            	        	[/code]

I have added this in jasperserver-servlet.xml to resolve to controller and view.

	    	      	        	        jsFileViewContr	        	        jsCommContr	        jsCommContr	        jsCommContr	        jsCommContr	        jsCommContr	        	        ssoContr	        .	        .	        .        	    	  	[/code]


This controller extends AbstractController to return a simple ModelAndView like below:

protected ModelAndView handleRequestInternal(
    HttpServletRequest httpservletrequest,
    HttpServletResponse httpservletresponse) throws Exception {
    return new ModelAndView("modules/ssoError");

When some error is encountered in my filter it calls the url /jasperserver/sso_error.html which gives status 404. The log file says

2013-01-16 23:29:51,470  WARN PageNotFound,http-8081-1:1077 - No mapping found for HTTP request with URI [/jasperserver/sso_error.html] in DispatcherServlet with name 'jasperserver'

Could you please advise what am I missing in this configuration.




Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...