Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IPentahoSession


  public PentahoSolutionFileProvider() {
    setFileNameParser( LayeredFileNameParser.getInstance() );

    // check if can bypass authentication
    try {
      IPentahoSession session = PentahoSessionHolder.getSession();
      if ( session != null ) {
        // running locally => access directly bypassing authentication
        this.bypassAuthentication = true;
      }
    } catch ( NoClassDefFoundError e ) {
View Full Code Here


    return job;
  }

  public Job getContentCleanerJob() throws SchedulerException {
    IPentahoSession session = getSession();
    final String principalName = session.getName(); // this authentication wasn't matching with the job user name,
    // changed to get name via the current session
    final Boolean canAdminister = getPolicy().isAllowed( AdministerSecurityAction.NAME );

    List<Job> jobs = getScheduler().getJobs( getJobFilter( canAdminister, principalName ) );
View Full Code Here

    }
    return true;
  }

  public List<Job> getJobs() throws SchedulerException {
    IPentahoSession session = getSession();
    final String principalName = session.getName(); // this authentication wasn't matching with the job user name,
    // changed to get name via the current session
    final Boolean canAdminister = canAdminister( session );

    List<Job> jobs = getScheduler().getJobs( new IJobFilter() {
      public boolean accept( Job job ) {
View Full Code Here

  public boolean validate() {
    return true;
  }

  protected ByteArrayOutputStream getContentAsStream( final String mimeType ) {
    IPentahoSession userSession = getSession();

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    SimpleOutputHandler outputHandler = new SimpleOutputHandler( outputStream, true );
    outputHandler.setOutputPreference( outputPreference );
View Full Code Here

  @Override
  public <T> T
  runAsUser( final String principalName, final IParameterProvider paramProvider, final Callable<T> callable )
    throws Exception {
    IPentahoSession origSession = PentahoSessionHolder.getSession();
    Authentication origAuth = SecurityContextHolder.getContext().getAuthentication();
    try {
      becomeUser( principalName );
      return callable.call();
    } finally {
      IPentahoSession sessionToDestroy = PentahoSessionHolder.getSession();
      if ( sessionToDestroy != null && sessionToDestroy != origSession ) {
        try {
          sessionToDestroy.destroy();
        } catch ( Exception e ) {
          e.printStackTrace();
        }
      }
      PentahoSessionHolder.setSession( origSession );
View Full Code Here

   * @throws Exception
   * @see {@link Callable}
   */
  @Override
  public <T> T runAsAnonymous( final Callable<T> callable ) throws Exception {
    IPentahoSession origSession = PentahoSessionHolder.getSession();
    Authentication origAuth = SecurityContextHolder.getContext().getAuthentication();
    try {
      PentahoSessionHolder.setSession( new StandaloneSession() );

      // get anonymous username/role defined in pentaho.xml
View Full Code Here

  /**
   * Runs code as system with full privileges.
   */
  public <T> T runAsSystem( final Callable<T> callable ) throws Exception {
    String singleTenantAdmin = PentahoSystem.get( String.class, "singleTenantAdminUserName", null );
    IPentahoSession origSession = PentahoSessionHolder.getSession();

    Authentication origAuth = SecurityContextHolder.getContext().getAuthentication();

    StandaloneSession session = null;
    try {
View Full Code Here

  public void onApplicationEvent( final ApplicationEvent event ) {
    if ( event instanceof InteractiveAuthenticationSuccessEvent || event instanceof AuthenticationSuccessEvent) {
      logger.debug( "received InteractiveAuthenticationSuccessEvent" ); //$NON-NLS-1$
      logger.debug( "calling PentahoSystem.sessionStartup" ); //$NON-NLS-1$
      try {
        IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
        Assert.notNull( pentahoSession, "PentahoSessionHolder doesn't have a session" );
        IParameterProvider sessionParameters = new PentahoSessionParameterProvider( pentahoSession );
        PentahoSystem.sessionStartup( pentahoSession, sessionParameters );
      } catch ( Exception e ) {
        logger.error( e.getLocalizedMessage(), e );
View Full Code Here

    if ( event instanceof AuthenticationSuccessEvent ) {
      logger.debug( "received " + event.getClass().getSimpleName() ); //$NON-NLS-1$
      logger.debug( "synchronizing current IPentahoSession with SecurityContext" ); //$NON-NLS-1$
      try {
        Authentication authentication = ( (AbstractAuthenticationEvent) event ).getAuthentication();
        IPentahoSession pentahoSession = PentahoSessionHolder.getSession();
        Assert.notNull( pentahoSession, "PentahoSessionHolder doesn't have a session" );
        pentahoSession.setAuthenticated( authentication.getName() );
        // audit session creation
        AuditHelper.audit( pentahoSession.getId(), pentahoSession.getName(), pentahoSession.getActionName(),
            pentahoSession.getObjectName(), "", MessageTypes.SESSION_START, "", "", 0, null ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      } catch ( Exception e ) {
        logger.error( e.getLocalizedMessage(), e );
      }
    }
  }
View Full Code Here

      response.setContentType( "text/xml" ); //$NON-NLS-1$
      response.setCharacterEncoding( LocaleHelper.getSystemEncoding() );
      // PentahoHttpSession userSession = new PentahoHttpSession(
      // request.getRemoteUser(), request.getSession(),
      // request.getLocale() );
      IPentahoSession userSession = getPentahoSession( request );

      String instanceId = request.getParameter( "instance-id" ); //$NON-NLS-1$
      String processId = this.getClass().getName();

      OutputStream contentStream = new ByteArrayOutputStream();
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IPentahoSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.