Jump to content
Changes to the Jaspersoft community edition download ×

gdmoreno

Members
  • Posts

    114
  • Joined

  • Last visited

Community Answers

  1. gdmoreno's post in Identifying the currently logged in user. was marked as the answer   
    Hi,
     
    Try what you see below, you'll have to put into the java class that makes sense in your case.Code:// Add these imports to your Java class

    import com.jaspersoft.jasperserver.api.metadata.user.domain.impl.client.MetadataUserDetails;
    import org.springframework.security.Authentication;
    import org.springframework.security.context.SecurityContextHolder;

    // Put this in the method you need the username

    String username; // will store logged-in username here

    // Using Spring to pull authentication info
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null && auth.getPrincipal() != null) {
    username = ((MetadataUserDetails) auth.getPrincipal()).getUsername();
    }

    // Do what you need to do here



  2. gdmoreno's post in Jasper Reports Support for .NET web application??? was marked as the answer   
    If you're runing IIS, and if you're willing to set up JasperReports server, you can set up a Tomcat server somewhere and integrate the two applications. You would probably need to set up a single-sign solution between them to handle the authentication isses. If you're using Active Directory, it should be pretty straightforward. You could set up iFrames, make web services calls (via the SOAP/REST API)  from your .NET web app to JasperReports Server. The advantage of this approach is that you get a lot of good server functionality beyond just the JasperReports library.
     
    If you can't do that, and can only use the JasperReports Java library itself, then you'll have to set up some kind fo .NET -> Java bridge first, which I'm less familiar with.
     
     
×
×
  • Create New...