Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
security issues while using BIRT with PHP
jaykv
I am using BIRT 2.5 in a PHP web application (back-end PostgreSQL). birt rptdesign file is put in a sub directory birt-viewer of webapps directory of Tomcat. report is called through my web application and is working fine . I used the following syntax in a php page for calling the report through the browser
"http:// <m/c name> :port/birt-viewer/frameset?__report=filename.rptdesign&my_parametername=my_parameter_value";
Report is working fine. The problem is that I can directly called the report using the above url instead of going through the application. It arises security isuues. i want the report is to be called through my application only. How can I put user credentials ? I have read that it can be done using context object of birt. Can anybody give example pl.
regards
Jayakumar K.V
Find more posts tagged with
Comments
JasonW
Take a look at a couple other threads:
http://www.eclipse.org/forums/index.php/m/261676/#msg_261676
and
http://www.eclipse.org/forums/index.php/m/239716/#msg_239716
You could forward to a jsp page that adds some key to session and then check the session in the report design.
Jason
jaykv
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="83913" data-time="1318271942" data-date="10 October 2011 - 11:39 AM"><p>
Take a look at a couple other threads:<br />
<br />
<a class='bbc_url' href='
http://www.eclipse.org/forums/index.php/m/261676/#msg_261676'>http://www.eclipse.org/forums/index.php/m/261676/#msg_261676</a><br
/>
<br />
and<br />
<br />
<a class='bbc_url' href='
http://www.eclipse.org/forums/index.php/m/239716/#msg_239716'>http://www.eclipse.org/forums/index.php/m/239716/#msg_239716</a><br
/>
<br />
You could forward to a jsp page that adds some key to session and then check the session in the report design.<br />
<br />
Jason<br /></p></blockquote>
<br />
Dear Jason,<br />
<br />
I have created a session variable- myattrib in my php page that calls the birt report viewer through tomacat.<br />
<br />
and in designer, I tried to access it through the script <br />
var session =reportContext.getHttpServletRequest().getSession();<br />
myattrib = session.getAttribute("myattrib");<br />
<br />
But I am not getting the method, getSession() and consequently it returns null.<br />
how can I get this method? is there any version problem ? I am using birt 2.5<br />
pl. reply<br />
<br />
thanks<br />
<br />
Jayakumar K.V
JasonW
You are probably not going to get your session variable in the designer, but it should show up when you deploy the report. Get Session should not be returning null in the designer only your attribute.
Jason
jaykv
Dear Jason,<br />
<br />
I am calling the report through browser. (mozilla). My problem is that while writing the script, <br />
reportContext.getHttpServletRequest() doesn't show the method getSession(). It has the following methods only:<br />
<br />
equals()<br />
getClass()<br />
hashCode()<br />
notify()<br />
notifyAll()<br />
toString()<br />
wait(long arg1)<br />
wait()<br />
wait(long arg1,int arg2)<br />
and, as a result the assignmentis not happening and resulting a Null.<br />
<br />
<br />
Why this method is not showing in the popup ?<br />
pl. go through the scrren shots included in the attached file<br />
<br />
regds<br />
jay<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="83973" data-time="1318349481" data-date="11 October 2011 - 09:11 AM"><p>
You are probably not going to get your session variable in the designer, but it should show up when you deploy the report. Get Session should not be returning null in the designer only your attribute.<br />
<br />
Jason<br /></p></blockquote>
jaykv
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="83973" data-time="1318349481" data-date="11 October 2011 - 09:11 AM"><p>
You are probably not going to get your session variable in the designer, but it should show up when you deploy the report. Get Session should not be returning null in the designer only your attribute.<br />
<br />
Jason<br /></p></blockquote>
Dear Jason,<br />
<br />
I am calling the report through browser. (mozilla). My problem is that while writing the script, <br />
reportContext.getHttpServletRequest() doesn't show the method getSession(). It has the following methods only:<br />
<br />
equals()<br />
getClass()<br />
hashCode()<br />
notify()<br />
notifyAll()<br />
toString()<br />
wait(long arg1)<br />
wait()<br />
wait(long arg1,int arg2)<br />
and, as a result the assignmentis not happening and resulting a Null.<br />
<br />
<br />
Why this method is not showing in the popup ?<br />
pl. go through the scrren shots included in the attached file<br />
<br />
regds<br />
jay
JasonW
It will not show up in the code complete, but it should still access it. BTW try it in the beforeFactory event instead of the initialize.
Jason
jaykv
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="84042" data-time="1318440312" data-date="12 October 2011 - 10:25 AM"><p>
It will not show up in the code complete, but it should still access it. BTW try it in the beforeFactory event instead of the initialize.<br />
<br />
Jason<br /></p></blockquote>
<br />
Dear Jason,<br />
<br />
I could open the report through a jsp page. In jsp page I am creating session variables and I am able to get these variables in beforefactory event of BIRT. Now on checking some conditions using this variable, how can I stop the execution of the report? something like Engine.shutdown....<br />
<br />
<br />
for example : if (myattribute == null)<br />
{<br />
<br />
// here I want to stop the execution & to give a message<br />
}<br />
<br />
Pl. help <br />
<br />
regds<br />
<br />
jay
JasonW
Take a look at this thread:
http://www.eclipse.org/forums/index.php/t/163655/
You could also add a client side script in a text element that looks for a value you set at runtime and if it exists the report automatically forwards.
<script type="text/javascript">
function forward() {
var temp = new String(location.href);
location.replace("
http://www.google.com")
;
return false;
}
if( <VALUE-OF>params["forward"].value</VALUE-OF> ){
forward();
}
</script>
Jason
jaykv
Dear Jason,
I could solve the issue through the way you suggested.
Redirected the report call from PHP to a jsp page and there I asked user credentials,
passed it as session variables. in BIRT brforeFactory event I got these session variables and
evaluated, and on unauthorised access, shows a message for login properly and disables the report.
Through this, I could stop calling report directly giving the url of birt-viewer frameset which was a security loophole.
Thanks for your valuable help.
regards
jayakumar K.V
Sr.System Analyst
National Informatics Centre(NIC)
Govt. of India
JasonW
Nicely done!
Jason