Topic
  • No replies
WesleyMan
WesleyMan
1 Post

Pinned topic Single sign on for PE and CE

‏2013-04-24T04:42:56Z |

Hi, i am trying to find out how to connect to the PE / CE with the java API by using the same user that is logged onto Business Space.

Would the following work for connecting to either?

 

 


Subject subject = Subject.getSubject(AccessController.getContext());

        if (subject == null) {

            log.info("Subject was null! Will use default login credentials for PE request.");

            return null;

        }


        log.info("Found security subject in context; pushing subject into current user context");

        UserContext old = UserContext.get();

        UserContext uc = new UserContext();

        uc.pushSubject(subject);

        UserContext.set(uc);

        log.info("Set UserContext for current request.");

      

//perform request using VWSession.

 

   UserContext.set(old);

 

I want to do this for each operation to a VWSession which has already been established prior with other credentials:

 

session = new VWSession();

            log.info("Connecting to Process Engine at url: [" + configuration.getUrl() + "] at connection point: [" + configuration.getConnectionPointName() + "]");
            session.setBootstrapCEURI(configuration.getUrl());
            session.logon(configuration.getUser(), configuration.getPassword(), configuration.getConnectionPointName());
            log.info("Connection to PE established.");

 

Will this approach work?