Jump to content

Not prompting for user/pass at logon


lamontj

Recommended Posts

Is there any way to pass a Username/Password to JapserServer to remove the need for a user to enter this information manually? Preferably, I would not want to change how these credentials are authenticated - that is already handled properly. I have an application that will open up JasperServer in a browser, and I would like to skip the JasperServer login page.

Is there a way I can pass such credentials through the URL, or is there another way this is generally done.

Thanks in advance for your help.

Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

You need a custom Acegi filter for this. I'm attaching a jar containing such a filter (which will be included in JasperServer starting with the next release).

To use it, you have to copy the jar into WEB-INF/lib and edit applicationContext-security.xml to include the filter in the Acegi filter list (notice the bold parts):

Code:
                        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON            PATTERN_TYPE_APACHE_ANT            /xmla=httpSessionContextIntegrationFilter, basicProcessingFilter, JIAuthenticationSynchronizer, anonymousProcessingFilter, basicAuthExceptionTranslationFilter, filterInvocationInterceptor            /services/**=httpSessionContextIntegrationFilter,portletAuthenticationProcessingFilter,basicProcessingFilter,JIAuthenticationSynchronizer,anonymousProcessingFilter,basicAuthExceptionTranslationFilter,filterInvocationInterceptor                /**=httpSessionContextIntegrationFilter,userPreferencesFilter,authenticationProcessingFilter,userPreferencesFilter,basicProcessingFilter,requestParameterAuthenticationFilter,JIAuthenticationSynchronizer,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor,switchUserProcessingFilter                            /loginerror.html[/code]			

Then, you will be able to do http://.../jasperserver/...&j_username=..&j_password=..

HTH,
Lucian [file name=paramsAuthFilter.jar size=4935]

Post edited by: lucianc, at: 2008/02/28 16:31
Post edited by: lucianc, at: 2008/02/28 16:32

Link to comment
Share on other sites

Hi Lucian,
I copied the jar that you've attached to web-inf/lib folder and modified the applicationContext-security.xml
 

Code:
                        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON            PATTERN_TYPE_APACHE_ANT            /xmla=httpSessionContextIntegrationFilter, basicProcessingFilter, JIAuthenticationSynchronizer, anonymousProcessingFilter, basicAuthExceptionTranslationFilter, filterInvocationInterceptor            /services            [/code]			

but was confused with the url http://.../jasperserver/...&j_username=..&j_password=..

could understand what to pass after /jasperserver/???
so that j_username and j_password are passed as parameters.

Waiting for you kindest reply,
Thanks,
Sure

Link to comment
Share on other sites

You can use any JasperServer URL by appending the j_username and j_password GET parameters. For instance, you could do something like

 

http://localhost:8080/jasperserver/home.html

?j_username=myuser&j_password=mypassword

 

or, if you want to launch a report execution

 

http://localhost:8080/jasperserver/flow.html

?_flowId=viewReportFlow&reportUnit=/reports/myFolder/myReport

&j_username=myuser&j_password=mypassword

 

HTH,

Lucian

 

Post edited by: lucianc, at: 2008/03/05 17:57

Post edited by: lucianc, at: 2008/03/05 17:58

Link to comment
Share on other sites

  • 1 month later...

Hi Lucianc,
For the record, I am using JasperServer 2.1 on a windows platform.
And on to the problems: the attached file above is not a jar but a zip when I download it, can I rename it to a jar? Anyway, I did that and dropped it in the following directory: "...jasperserver-2.1apache-tomcatwebappsjasperserverWEB-INFlib", but then when I tried to edit the "applicationContext-security.xml", that is located one step up from the above directory, I noticed that the configuration already looked like what you suggested:

Code:
                        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON            PATTERN_TYPE_APACHE_ANT            /xmla=httpSessionContextIntegrationFilter, basicProcessingFilter, JIAuthenticationSynchronizer, anonymousProcessingFilter, basicAuthExceptionTranslationFilter, filterInvocationInterceptor            /services/**=httpSessionContextIntegrationFilter, portletAuthenticationProcessingFilter, basicProcessingFilter, JIAuthenticationSynchronizer, anonymousProcessingFilter, basicAuthExceptionTranslationFilter, filterInvocationInterceptor            /**=httpSessionContextIntegrationFilter, userPreferencesFilter, authenticationProcessingFilter,  userPreferencesFilter, basicProcessingFilter, JIAuthenticationSynchronizer, anonymousProcessingFilter, exceptionTranslationFilter, filterInvocationInterceptor, switchUserProcessingFilter            [/code]			

Anyway after restarting the Tomcat server, I try to open the url for the report. If I use:
"...&j_acegi_security_check?&j_username=joeuser&j_password=joeuser" I get a well known "org.acegisecurity.AccessDeniedException: Access is denied" error.
On the other hand if I use:
"...&j_username=joeuser&j_password=joeuser" I end up on the login page.
:(Any suggestions?
Another way of solving this could be using LDAP/windows directory logon, would that allow me to drop the "j_username..." when opening a report URL?
Thanks

Link to comment
Share on other sites

ianpottier wrote:


And on to the problems: the attached file above is not a jar but a zip when I download it


I'm not sure why you say that, I downloaded the file and it got saved as paramsAuthFilter.jar.
 

I noticed that the configuration already looked like what you suggested:


Apparently the forums have a problem with code chunks, the XML fragment I posted is not fully displayed. I'm attaching a text file containing the applicationContext-security.xml changes; what needs to be done is to add the requestParameterAuthenticationFilter bean definition, and to insert requestParameterAuthenticationFilter in the filter list for "/**" after basicProcessingFilter.
 

Another way of solving this could be using LDAP/windows directory logon, would that allow me to drop the "j_username..." when opening a report URL?


Adding an LDAP authentication filter would indeed eliminate the need for authenticating via j_username request parameters.

Regards,
Lucian [file name=changes.txt size=1419]
Post edited by: lucianc, at: 2008/04/17 11:22

Link to comment
Share on other sites

  • 4 weeks later...

Hi Lucian,

The .jar file provided by you here is not getting downloaded as .jar but as .zip file of 80kb size. Can you plz provide it again.
I have attached along the .zip file which which is give as download

Thanks
Ekjot [file name=paramsAuthFilter.zip size=82463]

Link to comment
Share on other sites

ekjot.s.arora wrote:


The .jar file provided by you here is not getting downloaded as .jar but as .zip file of 80kb size. Can you plz provide it again.
I have attached along the .zip file which which is give as download


I'm attaching the jar again. I don't know why you get a zip, the download works fine for me. The MD5 hash of the jar is 78580e7fc232a879c06cee0ae1e7d300.

Regards,
Lucian [file name=paramsAuthFilter-c27b55a70f5b7e4cf5e867356cc78005.jar size=4935]

Link to comment
Share on other sites

ekjot.s.arora wrote:

Can you also provide full path for WEB-INF/lib as there are many links for such hierarchy in server and also the path for applicationContext-security.xml which needs to be edited

 

I'm afraid I can't know the full path of JasperServer on your computer, it depends on how and where you chose to install JasperServer.

 

In any case, JasperServer is (usually) installed as a Tomcat web application, so if you know the location of Tomcat, the paths you need are $TOMCAT/webapps/jasperserver/WEB-INF/lib and $TOMCAT/webapps/jasperserver/WEB-INF/applicationContext-security.xml.

 

Regards,

Lucian

Link to comment
Share on other sites

  • 2 weeks later...

Hi lucianc,

 

I have a small problem. I am trying to call a report from a hyperlink in another report. the called hyperlink should first show me the prompt(made from report unit) and then display the report in html accordingly.

now when i used the following link to call it

 

http://hydhtc74348:8080/jasperserver/j_acegi_security_check/flow.html?_flowId=viewReportFlow&reportUnit=/ODS_Reports/Batchs_Report&decorate=yes&j_username=jasperadmin&j_password=jasperadmin

 

it works fine, shows the prompt and then on giving input value the report in html. But i dont want to show the default header of jasper server (showing logo of jasper and welcome and menu etc). So i tried putting in decorate=no in the url. but on doing so it does not show anything on screen. Can you suggest some way of doing the above required thing.

 

I tried another way when i gave decorate=no and also output=pdf, then it showed the required prompt witout all the headers but problem is that output is pdf and i require it in html

 

Can you plz suggest some solution for the problem

 

Regards

Ekjot

Link to comment
Share on other sites

Hi Lucianc,

 

Just like the previous poster I did everything you outlined in your initial posts, and I still receive a login prompt when I attempt to view a report.

 

Any suggestions on where to begin to debug the problem?

 

thanx,

David

Link to comment
Share on other sites

dratster wrote:


Hi Lucianc,

Just like the previous poster I did everything you outlined in your initial posts, and I still receive a login prompt when I attempt to view a report.

Any suggestions on where to begin to debug the problem?

thanx,
David


You could edit the WEB-INF/log4j.properties file, add the following lines:

Code:

and then restart the server, try to access the URL and search the WEB-INF/logs/jasperserver.log file for "RequestParameterAuthenticationFilter". If the filter would work, you would see something like this in the log:

Code:


If you find no occurrence of "RequestParameterAuthenticationFilter" in the log file, it means that you haven't included the filter in your filter chain.

Regards,
Lucian

Link to comment
Share on other sites

ekjot.s.arora wrote:

But i dont want to show the default header of jasper server (showing logo of jasper and welcome and menu etc). So i tried putting in decorate=no in the url. but on doing so it does not show anything on screen.

The "decorate" parameter was not exactly meant to be used like this, however one could say that this is sort of a bug. You can fix it by editing WEB-INF/jsp/ViewReport.jsp and adding the following line in the head section:

Code:
<script language="JavaScript" src="${pageContext.request.contextPath}/scripts/jasperserver.js"></script>[/code]

If you think this needs to be fixed in JasperServer, please log a bug here.

Regards,
Lucian

PS: If you have a question that is not related to the original thread topic (Not prompting for user/pass at logon), you should start a new thread.

Link to comment
Share on other sites

  • 4 years later...

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