Jump to content
Changes to the Jaspersoft community edition download ×
  • This documentation is an older version of JasperReports Server Visualize.js Guide. View the latest documentation.

    The initialization of the script sets the authentication method and credentials you want to use for accessing JasperReports Server. You can then use the login and logout functions to manage multiple user sessions.

    This chapter contains the following sections:

    Authentication Properties
    Login With Plain Text Credentials
    Login With SSO Token
    Logging Out
    Login With Hooks
    UI for Login/Logout
    UI for Login/Logout With SSO Token
    Sharing Credentials Among Calls
    Using Visualize.js Without Authentication

    Authentication Properties

    The properties argument to the visualize function has all the fields for specifying various authentication methods.

    There are several ways to set the user credentials, based on your environment.

     

    Login With Plain Text Credentials

    Specify the username, password, organization (if required), and optional parameters in the authstructure.

    Login With SSO Token

    If you have single-sign-on (SSO) implemented and have configured JasperReports Server to use it, you can specify the SSO token for Visualize.js login. This example shows a token from a Central Authentication Service (CAS) server.

    Some SSO implementations require encoding, additional parameters, or both. For example, if your server is configured for pre-authentication, you could use the following example to authenticate from Visualize.js. Note that the encoded fields depend on the specifics of your pre-authentication configuration:

    Logging Out

    To log out and destroy the current user session, call the logout function and optionally specify any action to take when done.

    Login With Hooks

    If you have external authentication providers, you can invoke their login and logout URLs.

    UI for Login/Logout

    You can define IDs (#name) with listeners that perform login and logout functions. In your HTML, you can then assign these IDs to the appropriate buttons or links.

    UI for Login/Logout With SSO Token

    The code is slightly different if you have a login/logout UI and use SSO tokens. Note that the logout uses the .always event instead of .done.

    Sharing Credentials Among Calls

    Use the visualize.config function to define and store authentication credentials. It uses the same auth structure as the visualize function. You can then create several containers with separate calls to visualize, using the common credentials.

    Using Visualize.js Without Authentication

    Internally, Visualize.js uses the REST API to authenticate and interact with the server. However, the REST client receives and reuses the JSESSIONID cookie that identifies it as authenticated, which is also the same cookie used in regular browser clients. Therefore, users who access the JasperReports Server web app UI and use the same browser to run a visualize.js client before their session expires don't need to authenticate in visualize.js.

    If your visualize.js solution includes other browser windows or other authenticated REST calls, then you can simplify your visualize.js and remove the authentication:


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...