Hide Logout Option for Externally Authenticated Users in Jasper Report Server

Posted on by By Sayali Mahale, in Business Intelligence, Jaspersoft, Open Source Business Intelligence | 0

Hide logout option for externally authenticated users in Jasper Report Server

  • An external user is a user outside of an organization who does not directly login to Jasper Reports Server.
  • JasperReports Server does not store the passwords of external users, and is not impacted by changes to user passwords or user password policies on the external authority only the login name is stored in an external user account.
  • In JasperReports Server if you want to hide logout option for externally authenticated users, following are the steps to achieve it :

Used Jasper Report Server Version : 6.4.0

    1. Goto to path : \WEB-INF\decorators\
    2. Open the decorator.jsp file
    3. Comment below code :
    4. Import : “<%@ page import="org.springframework.security.core.context.SecurityContextHolder"%>“
        <authz:authorize ifNotGranted="ROLE_ANONYMOUS">
        <li id="main_logOut" class="last" role="menuitem">
        <a id="main_logOut_link" tabindex="-1">
        <spring:message code="menu.logout"/>
        </a>
        </li>
        </authz:authorize>

 

    1. Add below code before commented code which check for externally authenticated user and hides the logout option for it :

 

<c:set var="isExternallyDefinedUser" value="<%= ((com.jaspersoft.jasperserver.api.metadata.user.domain.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).isExternallyDefined()%>"/>

<c:if test="${!isExternallyDefinedUser}">

<authz:authorize ifNotGranted="ROLE_ANONYMOUS">

<li id="main_logOut" class="last" role="menuitem">

<a id="main_logOut_link" tabindex="-1">

<spring:message code="menu.logout"/>

</a>

</li>

</authz:authorize>

</c:if>

 

  1. Save decorator.jsp file

To test hide logout option for externally authenticated user :

  1. Custom authentication
  2. Manually update “externallydefined” flag in database and test.

We can test hide logout option for externally authenticated user by second mentioned way :

  1. Connect to Jasperserver postgres database.
  2. Check users present in jasperserver by executing below query :

Select * from jiuser;

  1. You will get all users details which are present in jasper server , check the id of user to which you want to make it as externally defined user.
  2. Let us assume if you want to make testuser as externally defined user and its id is 65874 then to make is as externally defined user execute below query which set the “externallydefined” flag/value to “t”.

Verify the set flag value by executing Select * from jiuser;

  1. Now restart the jasperserver and its repository(postgres).
  2. Login to jasper server with superuser access through browser.
  3. Goto->Mange->Users and select testuser.
  4. Click on Login as User button.

Picture1

9.You will directly logged with testuser which don’t having the logout option .

 

Picture2

 

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

Thanks,

Sayali Mahale | Helical IT Solutions

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments