Pass Principal to EJB from external app

Hello,
I have spent half a day with glassfish v2 trying to find what seems to be trivial information: how do I pass a caller's principal, so that it could be retrieved from EJBContext inside container (by ctx.getCallerPrincipal()).
I know that at least servlet container delegates it behind the scenes. But I need to do this manually from external java app, for ex., from junit tests. Without passing a principal, I am calling EJB without a problem by looking up the initial context with these params:
env.setProperty("java.naming.factory.initial", com.sun.enterprise.naming.SerialInitContextFactory");
env.setProperty("org.omg.CORBA.ORBInitialHost", "hostname");
env.setProperty("org.omg.CORBA.ORBInitialPort", "port");
env.setProperty(Context.PROVIDER_URL, "url");
I assumed that adding these line will solve the problem:
env.setProperty(Context.SECURITY_PRINCIPAL, "uname");
env.setProperty(Context.SECURITY_CREDENTIALS, "passw");
Hawever, with these settings the caller's pincipal name inside container is ANONYMOUS.
Can anyone help me out with this?
Thank you!

Hi,
of course I did. I guess there is no problem in doing all kind of stuff with app client container. However, the question is, how it is possible to delegate user's principal from external app, like JUNIT test runner?
There is simply no damn information about this! =(
Anyone, please?

Similar Messages

  • Pass req due date to external app

    Pass req due date to external app
    I have a service link agent configured to create items in an external system and I would like to pass the requistion due date as a service link parameter to the external application. Is there a way to do this using a namespace?

    For  our ServiceLink integrations, we have the due date being set in the  transformation since we always wanted it set for every service using the  agent.
    This will output the due date in the transformation:
    <xsl:value-of select="/message/task-started/task/due-date"/>

  • How to call OIM API from external app?

    Hi,
    I have an java application and I would like to call OIM API to accept a request. The application resides in separate server than OIM.
    My questions:
    *1.* What to do to call OIM API from external application (import any OIM jars etc.)?
    *2.* Which method to use, setRequestResponse , closeRequest or any other?
    I appreciate any help, thanks.
    Edited by: m.m. on Feb 2, 2010 5:33 AM

    Hello,
    If it is an external client, you need to provide the "login" and "password" details explicitly in the code (something like this), before getting any other Interface control to invoke the OIM APIs -
    public class OIMAPIClientTest {
    public static void main(String[] args) {
    try{
    System.out.println("Starting...");
    ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    Hashtable env = config.getAllSettings();
    tcUtilityFactory ioUtilityFactory = new tcUtilityFactory(env,"xelsysadm","abcd1234");
    System.out.println("Getting utility interfaces...");
    Regards,
    Amit
    Edited by: amitKumar on Feb 2, 2010 5:29 AM

  • Implicitly Passing Principal to EJB

    I can obtain my user Principal instance through
    HttpServletRequest.getUserPrincipal() (via a custom authentication
    implementation).
    What process do I follow so that EJB methods invoked in the scope of this
    request are passed the same Principal instance? Is this even possible?
    Thanks,
    Bob

    Normally that's what happens by default, i.e., if you obtain the EJB
    reference
    using the same context, you can use getCallerPrincipal() to get back the
    Principal from the EJB method, and it should reflect the same principal.
    regards,
    -Ade
    "Bob Lee" <[email protected]> wrote in message
    news:[email protected]..
    Oh yeah, WebLogic 6.1.
    Thanks,
    Bob
    "Bob Lee" <[email protected]> wrote in message
    news:3d2b3990$[email protected]..
    I can obtain my user Principal instance through
    HttpServletRequest.getUserPrincipal() (via a custom authentication
    implementation).
    What process do I follow so that EJB methods invoked in the scope of
    this
    request are passed the same Principal instance? Is this even possible?
    Thanks,
    Bob

  • Passing an XML file from WebDynpro app to ABAP function module

    Hi all,
    I'm stuck with a problem, and am hoping one of you could let me know how to proceed:
    I need to pass an XML file (or at least the entire content of the XML) from my WebDynpro application to a backend ABAP function module. What I tried was this:
    In my WebDynpro app, I read the XML and convert the content into one long string (using java.io.FileReader and java.io.BufferedReader). In my ABAP function module I created an import parameter of type String. I then imported the ABAP Function module into my WebDynpro app as a model. I then tried to pass the XML string to the ABAP module. What happens is this:
    If the size of the string (XML) happens to be less than 255 characters, then it works. That is, the string is passed to the ABAP function module and I can see the contents. However, if the XML string happens to be greater than 255 characters, then it does not work. The string at the ABAP side is empty. Surprisingly, the ABAP module does not throw an error either. It just displays an empty string.
    Could you please tell me what the problem is?
    Thanks & Regards,
    Biju

    Hi Biju ,
    Welcome to SDN.
    If the import parameter is defined as type string it should work, however did you check whether your application pass it properly?
    I have applications using strings as import parameters working fine. (webapplications (BSP) to RFC)
    Regards
    Raja

  • Repeatly passing data to and from external program

    I'm looking for some help to get me started.  I'm willing to bet
    the info is here I'm just not sure what to look for and my searches
    aren't reveiling anwsers. 
    Background: I'm trying to take control of a device that is comunicating
    through the PCI bus.  The device has a set of API dll's that I can
    access through C++, but not directly in LabVIEW.  So wish to creat
    a wrapper program that will give LabVIEW indirect access to the
    dlls.  
    Problem: I've breifly read up on CINs and Libaray call functions and
    have found one underlying problem with both.  I have not found a
    way to pass data back and forth between the external code and LabVIEW
    once the external code is running.  I require an interactive
    conection between the two. 
    Any sugestions of what to search for would be greatly appreatiated, or even how to resolve my problem.
    Thank you.
    Don't get even, get odd!

    If the data buffers are owned by the driver and are updated asynchronously, you should expose that buffer to LabVIEW as a handle (simple int32 for the pointer to the buffer). This can then be passed to the wrapper code and checked (implements your polling). Remember that handling tasks in LV that should run in parallel is different from C++ however - you don't create threads, instead you should simply set up independent loops.
    I'm not sure what else to suggest since I don't fully understand what the API does or what the HW is doing, so feel free to post more information if you want more suggestions
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • Accessing EJB from Console App.

    I have deployed in EJB with JNDI name "greeter" in Sun Java� System Application Server Platform Edition 8.
    Then i am trying to access EJB using a console app (given below).
    import javax.ejb.*;
    import javax.rmi.*;
    import java.util.*;
    import javax.naming.*;
    public class Client
    public static void main(String args[])
    Greeter myGreeterBean;
    GreeterHome myGreeterHome;
    Greeter myGreeterRemote;
    Context context = null;
    try
    context = new javax.naming.InitialContext();
    catch (Exception e)
    System.out.println( "Unable To Get Initial Context");
    return;
    System.out.println("Got Context...");
    try {
    String JNDIName = "greeter";
    Object objref = context.lookup(JNDIName);
    System.out.println("Got Access To Object");
    myGreeterHome =(GreeterHome) PortableRemoteObject.narrow(objref,
    GreeterHome.class);
    myGreeterRemote = myGreeterHome.create();
    String theMessage = myGreeterRemote.getGreeting();
    System.out.println(theMessage);
    catch(Exception ex) { System.out.println( ex.getMessage()); }
    } // end of main
    } // end of Client
    But, while i am running this program i am getting the following error:
    Got Context...
    Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    I don't know where i am wrong. Any idea about it ?
    Thank you,
    P.Srikanth.

    This is what you need to modify :)
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "<<your
    initial context factory>>");
    env.put(Context.PROVIDER_URL, "<<JNDI provider
    URL>>");
    // Check documentation for exact Strings to be set.
    // Pass the environment parameters to
    InitialContext.
    Context context = new InitialContext(env);
    Angel
    No this is not correct. Lookups in SUN AS works a bit differently.

  • How to launch processLaunch.jsp from external app.

    Hello smart people,
    Can an application external to Identity Manager post a request to /idm/processLaunch.jsp/id=workflowName&attributesHere ?
    We are able to launch a process from within IDM. For example we have added links to the end user menu that when clicked kickoff workflows. However is it feasable to have an application external to Identity Manager trigger a workflow.
    We will need create a connection/session to Identity Manager by
    - create a loginInfo object
    - create a session
    - login to the session
    Then we should be able to post a request to /idm/processLaunch.jsp/id=workflowName&attributesHere to trigger the custom workFlow.
    The post http://forum.java.sun.com/thread.jspa?forumID=764&threadID=5164691 makes me think this can be done.
    I'm not the sharpest knife in the drawer so I thought I'd post the question to get input from you smart people.
    Our Installation is IDM 7.1 / Oracle running on a Unix OS.
    Any thoughts?

    Hello,
    If it is an external client, you need to provide the "login" and "password" details explicitly in the code (something like this), before getting any other Interface control to invoke the OIM APIs -
    public class OIMAPIClientTest {
    public static void main(String[] args) {
    try{
    System.out.println("Starting...");
    ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    Hashtable env = config.getAllSettings();
    tcUtilityFactory ioUtilityFactory = new tcUtilityFactory(env,"xelsysadm","abcd1234");
    System.out.println("Getting utility interfaces...");
    Regards,
    Amit
    Edited by: amitKumar on Feb 2, 2010 5:29 AM

  • Accessing Instance info from external app

    We would like to provide a view of the instance information in BPEL within another web app. Specifically, a list of Instances, with the ability to click and get the Audit info.
    This would allow us some production visibility of our processes, without giving access to BPEL console directly.
    Anyway recommended "easiest" route to this?
    - Direct calls to BPEL DB?
    - Are there existing .jsps/components within BPEL that we can simply invoke?
    _mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Excellent, anyone have a link to the 10.1.2 JAVA BPEL API docs??
    _mike                                                                                                                                                                                       

  • Launch Fact sheet from external app

    Hi All,
    Please forgive my rookieness as I don't have much experience with SAP.
    I want to open a contact fact sheet in CRM 5.0 from a windows application. I have done similar things in salesforce.com and Microsoft CRM but am unsure how to do this with SAP web client.
    Basically, my windows application will have a contact's phone number and then launch the SAP web client and open that contact's SAP fact sheet.
    Can someone point me in the right direction?
    Does SAP offer a trial version of CRM that I can install locally to test?
    thank you,
    KF
    P.S. Why aren't the cookbooks (IC Web client, fact sheet, etc..) available in SDN? Would be nice to have a copy of those.

    This is a double post, please see my response to your previous post.

  • How to execute a java script from an external app

    Just new to Acrobat SDK,
    Given that I've started Acrobat from external app,
    I can get a JSObject, but how do I get ito execute a script
    e.g., found this in doco
         var pp = this.getPrintParams();
         pp.interactive = pp.constants.interactionLevel.automatic;
         pp.printerName = "Our office printer";
         this.print(pp);

    I was able to get it to work by coding directly in VB, but can you expand on the 2nd part, "pass it as a string to run"
    So, in VB I have
              jsObj = pdDoc.GetJSObject
    I tried
         jsObj = "var pp = this.getPrintParams(); ... "
    but that doesn't seem to do anything

  • How to pass values to dashboard prompts from external applications

    Any idea is well appreciated.
    How can I pass values of dashboard prompts from external applications to the dashboard prompts so that the dashboard is prefiltered based on values sent by external applications.
    Thanks in Advance!
    Kris

    Kris,
    i am able to change the session variable and able to call the dashboard from external app, but i identified prompt value not changing. but Finally i am able to found a workaround for you.
    Use the following URL and it explained here
    http://localhost:9704/analytics/saw.dll?Dashboard&nquser=Administrator&nqpassword=Administrator&PortalPath=/shared/abcd/_portal/dash1&Options=rmf&DSN=madan
    PortalPath is your dashboard location. /shared/abcd is folder where i saved dashboards. dash1 is my dashboard name.
    internally this dashboard includes many reports that uses the session variable. after doing above this i am able to update the session variable to the value i have given in URL, DSN=value.
    You may observer here that calls the dashboard and passes the value but its not updating the prompt value. so workaround for this is edit your prompt,
    change the Default to - SQL Results and place the sql
    SELECT CASE WHEN 1=0 THEN Markets.Region ELSE VALUEOF(NQ_SESSION.DSN) END saw_0 FROM Paint
    again here Market.Region is column from presentation layer and Paint is subject area. After doing this step, your prompt always shows value in the session varible as default.
    Now include reports and dashboard prompt in the dashboard and run this url from external applicaitons.
    http://localhost:9704/analytics/saw.dll?Dashboard&nquser=Administrator&nqpassword=Administrator&PortalPath=/shared/abcd/_portal/dash1&Options=rmf&DSN=madan
    it worked for me and blog this soon. if it works for you mark the question as answered and mark my replies as correct.
    thanks
    - Madan

  • File URL doesn't pass from another app

    I can enter the file URL "file:///sdcard/video.mp4" and the video plays just fine. When online it also brings up "www.file.com" in the window, which would be best that it didn't.
    When I pass the same URL from another app, the URL bar shows "http://www.file.com///sdcard/video.mp4", when online. When offline, it shows "http://file///sdcard/video.mp4". Consequently the video doesn't play.
    I have tried the same with 9 other browsers and the substituted URL is different, so I assume that it is the browser doing the substitution rather than the app.
    I want to play the video from the app through FireFox whether offline or online using the same URL that works directly.
    Thank you,
    Bob

    <embed URL> </embed>
    you can upload to youtube ,imageshack,blogger,photobucket...etc.
    <embed src="http://www.file.com/sdcard/video.mp4"></embed>
    【Reference】
    http://www.htmlcodetutorial.com/embeddedobjects/_EMBED.html
    http://rot2k5.blogspot.com/2011/09/swfavimp4gif.html
    http://rot2k5.blogspot.com/2011/06/yahoo-blogyoutube.html

  • Accessing username and group name from an external app

    How can I access the user name and group name from an external app..? Where is that stored..?
    Thanks
    Fernando

    Post Author: pvierheilig
    CA Forum: Crystal Reports
    Each BOE document has a unique ID.  Knowing that will allow you to access it via a URL while passing required login credentials as well, if I recall correctly.  However, your very best bet is to review the SDK.

  • Make Firefox open URLs passed from external applications in new tabs

    I upgraded Firefox (Mac) from 3.6.13 to 3.6.14 yesterday.
    Since then Firefox does not respond to URLs passed from external applications, as it has always done.
    The external apps pass the URL, FireFox is brought to the front, but no Tab (or new window) is opened.
    Nothing else has changed. Firefox is selected as my default browser (in Safari Prefs) and there is only one copy of FireFox on my laptop,

    Hi David
    Go to Safari Preferences>General. At the bottom you'll see an option for opening in a tab. Makes sure Tabs are enabled in your Tab panel.

Maybe you are looking for

  • Can I use one waveform to subtract from the other one in labview?

    Here is the thing. I am using DAQ to aquire amplified signal to measure its noise of output.However DAQ would contribute a little noise to the whole system.My thinking is to capture two waveforms of noise from DAQ itself and the whole system(amplifie

  • Need help reestablis​hing wireless connnectio​n

    we are now connected to a different router and modem and we cannot get the connect to printer wirelessly

  • Additional Results option ignores \n

    When including Additional results in my test stand sequence file, i save the complete listing of a text file to this option. Problem is, in the result file(html) it displayes it without any carriage returns and line feeds...resulting in a very messy

  • Late 2010 17-inch MacBook Pro beach ball freeze

    Hi all, this is my second to last resort (last is sending in for repair xD). Well anyways, hope that you guys can help me solve this problem so I won't have to go there . Here's the story: I recently purchased a custom, late 2010 17-inch MacBook Pro

  • Anyone know anything about BLENDER (3d app)

    Hi I'm wondering, Does anyone know anything about Freeware 3d App Blender? does it Run on the new Intel Mac Mini Machines running Tiger 10.4.5 ? I've tried there boards but got no response.... Cheers Keiran