IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  getUser

    Posted Tue July 11, 2017 02:27 PM

    Hi,
    I want to get the current user in my CAF portlet.

    I create this kink of Java code

    public com.webmethods.caf.faces.data.dir.UserModel getPerson()  {
    if (person == null) {
    person = new com.webmethods.caf.faces.data.dir.UserModel();
    }
    resolveDataBinding(PERSON_PROPERTY_BINDINGS, person, "person", false, false);
    return person;
    }
    

    This code supply me a provider to access to user information called person.

    And when I assign Principal ID in parameter of my WS which managed right, the bahviour is correct.

    But when I try with other user than my self (who am an Administrator) or Administrator, I have a JavaNullPointerException.
    I guess the person Object is not filled and I can not assign Person ID with parameter of my web service.

    The fact is in My Webmethod server I deny access to every objects for anyone (except Administrator) except the portlet I created.
    I guess to access to Provider which give information about user, I need user have right to see it but I don’t know where is it.


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 2.  RE: getUser

    Posted Tue July 11, 2017 03:20 PM

    Are you able to shared the stacktrace that shows where the NPE came from?

    If all you need is the username, you can probably just get the remote user from the current http request without using any MWS specific APIs.

    For example, from the JSF external context object like this:

    	public String getWhoAmI() {
    return getFacesContext().getExternalContext().getRemoteUser();
    }

    Or more simply directly using an expression that resolves to the same without writing any custom java code with a binding expression like this:

    #{request.remoteUser}

    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 3.  RE: getUser

    Posted Wed July 12, 2017 06:04 AM

    Hi Eric,
    Thx for your reply,
    Your function works.


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods