How to get Current Logged in user in Java

Hi All ,
I have written a code in to get the current logged in user in the portal in an EJB service.  I have used the code
*IUser user= UMFactory.getAuthenticator().getLoggedInUser();*. But surprisingly the userId which it returns is always is Guest. Can you please help on this issue.
Thanks & Regards,
Rohit

I do not know your EJB Service. But you should pass the credentials of the current logged on portal user to your service. That's not by default I think.
I had a similar problem with CAF developed webservices. I had to turn on permission checks in my web service and passed the credentials via logon ticket.
Regards, Bernd

Similar Messages

  • How to get current logged-in user name in data access driver or in universe

    In universe, to get the current log in user is via @Variable('BOUSER').
    Right now, I need to be able to get the user name in the data access driver. I am writing a customized data access driver because we need to patch some where clause on the the query generated by the universe based on the logged-in user info. I only think of using end_sql parameter or adding an universe level filter to patch the @Variable('BOUSER') to the query, which would not work if user want to use customized query.
    Can anyone tell me how to get currentBO user name from connection server ? or how @Variable('BOUSER') is translated into the logged-in user name in the universe?

    I do not know your EJB Service. But you should pass the credentials of the current logged on portal user to your service. That's not by default I think.
    I had a similar problem with CAF developed webservices. I had to turn on permission checks in my web service and passed the credentials via logon ticket.
    Regards, Bernd

  • OIM11gr2 - How to get currently logged in user details using oim api

    Hi All,
    I have a requirement to retrieve currently logged in users profile in the process adapter.
    I have tried with getSelfProfile in tcUserOperation and also ContextManager.getOIMUser API's however, in both the cases i am getting xelsysadm details only.
    Also as know request details in Process task mapping doesnot work for OIM11g onwards (its returning column not found exception )
    DOes any one has idea how to achieve this.
    PS. - i am using platform to retrieve API's.
    Thanks & Regards
    Swati Pandey

    You can get the logged in user name using the below java code:
    ADFContext adfCtx = ADFContext.getCurrent();
    SecurityContext secCntx = adfCtx.getSecurityContext();
    String user = secCntx.getUserPrincipal().getName();
    HTH

  • How to get current logged in user's star rating in SharePoint 2013

    Hi,
    Currently,  I am developing a custom web part to show star rating for documents, everything is done.
    However,when user hover on the star I want a tooltip message("Your current rating is 1..."), similar to what we have 
    in libraries(or what the sharepoint by default provides in libraries) . So can I get the user specific rating depending upon 
    the logged in user using code(.net or CSOM anything will work)

    using the below code you can get the rated by user along with the rating , it's easier to just notify the user that her already rated the document 
    var acontext = new SP.ClientContext.get_current();
    var lists=acontext.get_web().get_lists();
    var l =lists.getByTitle("Documents"); //your document libraty
    var aitem=l.getItemById(27);//Item id
    acontext.load(aitem, "RatedBy", "ID", "Ratings");
    acontext.executeQueryAsync(function(){
    var RatedBy= aitem.get_item('RatedBy');
    if (!SP.ScriptHelpers.isNullOrUndefined(ratings)) {
    for (var i = 0; i < RatedBy.length; i++) {
    var user = RatedBy[i];
    if (user.get_lookupId() == _spPageContextInfo.userId) {
    //show that you already rate it
    break;
    },function(s,e){alert(e.get_message());});
    another way is to use CAML query to check if the current user id is within the RatedBy multi user field
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • How to get currently logged in user on 'Bill of Material' Form in Add-Mode

    Dear All,
                    I am using a UDF on 'Bill of Material' Form in SAP. This UDF is named as Current_User. I want in this UDF the user name that is currently logged in to SAP. I am able to get user name at form load event. But when 'Bill of Material' Form comes in ADD Mode, the user name doesn't display. What can I do for this problem.? Here is my code:
    public override void Handle_SBO_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;                 
                try
                    if ((mst_FormUIDModal != null))
                        if (FormUID != mst_FormUIDModal)
                            bool dbo_FormFound = false;
                            foreach (SAPbouiCOM.Form dsa_Form in this.SBO_Application.Forms)
                                if (dsa_Form.UniqueID == mst_FormUIDModal)
                                    if (FormUID != mst_FormUIDModal)
                                        if (this.SBO_Application.Forms.Item(mst_FormUIDModal).Selected == false)
                                            this.SBO_Application.Forms.Item(mst_FormUIDModal).Select();
                                        BubbleEvent = false;
                                        return;
                                    dbo_FormFound = true;
                            if (!dbo_FormFound)
                                this.mst_FormUIDModal = null;
                    if (pVal.BeforeAction == false)
                        switch (pVal.EventType)
                            case BoEventTypes.et_FORM_LOAD:
                                    if (pVal.FormType == -672)
                                        Program.Curr_User = SBO_Company.UserName;
                                        doc_form = this.SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount);
                                        ((SAPbouiCOM.EditText)doc_form.Items.Item("U_User").Specific).Value = Program.Curr_User;
                                } break;

    Hi,
    You need not to write any sdk code for this task. You just create a user query as mentioned above and save it with some name.
    Then Open the Bill Of Material Screen, just click in the required field, then click alt + shift + f2 to assign a Formatted Serach.
    Then Select 3 rd Option       "Search in Existing User-Defined Values According to Saved Query"
    Then Click on the button "Open Saved Query"
    It will open the Query Manager. Select the Saved Query.
    Enable the Option "Auto Refresh When Field Changes"
    In the Drop Down list, select the Value "Parent Item"
    Then Select the Option Refresh Regularly or Display Saved Values.
    This will automatically put the user code if the parent item is selected.
    You an achieve this by without SDK Code.
    PS:
    There is a change in the Above Query:
    Select USER_CODE from ousr where userid = $[USER]
    Edited by: Manikandan K on Dec 22, 2011 2:00 PM

  • How to get/capture log-on user name on PC (work station)

    Hi,
    Colud anyone give me how to get/capture log-on user name on my PC (work station)?
    I need to get the infomation by using a function module.
    Kind regards,
    Hisao

    Hi,
    TH_USER_INFO shows me terminal ID, IP address and other information. howerver it does't show me log-on user name of OS.
    Kind regards,
    Hisao

  • How to get Current Log in BO user name in data access driver

    In universe, to get the current log in user is via @Variable('BOUSER').
    Right now, I need to be able to get the user name in the data access driver. I am writing a customized data access driver because we need to patch some where clause on the the query generated by the universe based on the logged-in user info. I only think of using end_sql parameter or adding an universe level filter to patch the @Variable('BOUSER') to the query, which would not work if user want to use customized query.
    Can anyone tell me how to get currentBO user name from connection server ? or how @Variable('BOUSER') is translated into the logged-in user name in the universe?

    Shweta,
    The link you provided was the Auditor guide for BO 6.x, I'm not sure it that is going to help Karen or not.
    Karen,
    There is function called connection
    (usage:  =connection([Query Name]), where [Query Name]
    denotes the name of the tab for the query under Edit Query)
    Here is some of the output from connection:
    4;ODBC18;MS SQL Server 2000166; VERSION=7; USER=xxxxx;
    PASSWORD=; DBTYPE=Relational; DATABASE=xxx_xxxx;
    ODBC_USER=xxxxxx; ODBC_PASSWORD=; BO_DSN=xxxx_xxxx;
    BO_DRV_CONNECT_MODE=0; 224; VERSION=6; Name=xxxxx; Shared=4;
    LoginTimeout=600; Timeout=600; Pool Time=60; Array Fetch Size=10;
    Array Bind Size=5; RecommendedLenTransfert=1000; Password_Encryption=x;
    AliasTable=; MeasureDimension=; Hint=; ConnectInit=; ArrayFetch=1;
    I'm not sure if this info helps out either, being that connection provides info on a post-processing basis and it sounds like you need to get out ahead of the SQL generation.  The @variable('bouser') would seem like the place to be, however, in allowing custom SQL to take place you loose the bouser due to an individual could customize the SQL to the point that it gets unwantingly yanked out.  The end_sql might be your answer...
    Thanks,
    John

  • How to get the logged in user to accept remote management

    Hi,
    It possible to have the currently logged in user to accept or reject a Remote Desktop connection?
    The reason is that the remote administrator taking control should not be able to see the currently logged in user without him knowing it. I know about the "being observed" icon but that's not enough.
    I want the remote administrator to be able to work freely when no users are logged in but if a user is logged in, I want some kind of request/validation-or-rejection mechanism before the remote desktop administrator can take control of the mac.
    Is that possible?
    Ludo

    ARD supports both modes that you desire... The problem, as I recall, is that these are "all or nothing" switches you get one way, or the other, but you can't have it both ways.
    The controls for these options lie behind the "Computer Settings..." button in the Sharing Prefs panel.
    "Anyone may request permission to control the screen"
    and
    "VNC viewers may control the screen with password:"

  • Get current logged in user in sharepoint 2013 hover display template

    Hi,
    Can somebody tell me how the current logged in username can be retreived in hover display template to be used in search result.
    i tried using rest api but that is very difficult to get as it is to be done using ajax call and if we do getting a return value asynchronous is difficult.
    Please help

    Hello,
    You might use the function used in the Visual Studio SharePoint App template:
    var context = SP.ClientContext.get_current();
    var user = context.get_web().get_currentUser();
    $(document).ready(function () {
    getUserName();
    function getUserName() {
    context.load(user);
    context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
    function onGetUserNameSuccess() {
    $('#message').text('Hello ' + user.get_title());
    function onGetUserNameFail(sender, args) {
    alert('Failed to get user name. Error:' + args.get_message());

  • How to show current logged in user image in Master Page

    Hi,
    I am trying to show logged in user image next to his name, following this article 
    http://erikswenson.blogspot.in/2011/04/display-user-profile-picture-next-to.html
    I am trying to do this in SharePoint 2013, so i put Reference
    in .Master file & Control in . html file
    Picture is not visible and when i tried to find whether the control has been loaded or not, the control also hasn't been loaded.
    Please tell me, how could i do this?

    This is not that hard to do, simply go into your masterpage (Design Manager) and copy and paste this on the top of the page:
    <%@ Register tagprefix="SPSWC" namespace="Microsoft.SharePoint.Portal.WebControls" assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    Once that is done, you can now add this:
    <SPSWC:ProfilePropertyLoader runat="server" />
    <SPSWC:ProfilePropertyImage PropertyName="PictureUrl" ResizeToFit="115" ShowPlaceholder="true" id="PictureUrlImage" runat="server"/>
    To the location where you want the image to be shown. If you have a custom HTML page that you built out, just add it the same way. Let me know if you have any questions.
    -G

  • How to get current file position information in JAVA ?

    Hello,
    I would like to know if someone knows how to get and set current file position information in JAVA ?
    In C I use fgetpos and fsetpos.
    Thanks

    Instead of using a standard java.io.File, use java.io.RandomAccessFile
    This is a great class - you can get the file pointer (getFilePointer()), and set it (seek(long pos) )
    that will do all you need I presume - works the same a file handle in C.
    james

  • Command in JSP to get current logged in user.

    Hello Experts,
    We have a web page written in JSP.
    Once we call to this web page. I want to fetch username of the person who has logged in currently to system.
    is there is any single word command to get this ?
    Thanks In Advance..
    Avinash Shrivastava

    avinash101 wrote:
    Hi BalusC,
    First of all Thanks for your reply, but this JSP page will be saved in Server and user will access this site from client machine.
    Please suggest how to go in this scenario.
    Thanks Again,
    AvinashJSP runs at the server machine. It would only return the user name of the server machine. All what the client got is the HTML output produced by JSP, it doesn't get any line of JSP/Java code. You need to run Java at the client machine. A signed applet and web start app can do that.

  • Get current logged portal  user information

    Hi,
    I need to get information about current user logged to the portal from a J2EE application. I developed an Enterprise application project with a java servlet and I integrated it into the portal as an URL iView.
    This in the code of servlet:
    import com.sap.security.api.*;
    IUserFactory userFactory= UMFactory.getUserFactory();
         IUser user= UMFactory.getAuthenticator().getLoggedInUser();
         out.println(user.getUniqueID().toString());
         out.println(user.getDisplayName().toString());
         out.println(user.getName().toString());
         out.println(user.getUniqueName().toString());
    When I run my application I have this output:
    USER.PRIVATE_DATASOURCE.un:Guest Guest, Guest Guest
    But I access with another user, it's not Guest.
    How can I solve this problem???THANKS

    Hi,
    Please try checking with following code
    ISearchResult rst = UMFactory.getUserFactory().getUniqueIDs();
                      IUserFactory usf = UMFactory.getUserFactory();
                      IUser iuser = null;
                      IUserListElement userElement = null;
                      int i = 0;
                      while (rst.hasNext()) {
                      iuser =  UMFactory.getUserFactory().getUser(rst.next().toString());
                      String email = iuser.getEmail();
                       String fname = iuser.getFirstName();
                        String lname = iuser.getLastName();
    let me know if there are any issues.
    regards
    Anil

  • Get current logged in user's Apple ID

    Hi,
    I'm trying to implement a rating feature on an app I'm developing, but it's giving me a problem wich is that every user of the app can rate something one and only one time, wich means I can't use his/her IP nor MAC Address, I need something global like the user's e-mail associoated with apple's account, Apple ID or wathever it is that distinguishes users in the App Store. So, is there a way of getting this information in AIR or native language (so I can create an ANE)? Just a simple method that returns the user's ID is what I need.
    Thanks in advance.

    Ok, after some ersearch I found an extension by MilkmanGames called RateBox, here are some links:
    http://www.milkmangames.com/blog/tools/#ratebox (for the extension)
    http://www.adobe.com/devnet/air/articles/ratebox-ane-ios-android.html (for a tutorial)
    Can anyone confirm if this works for rating in-app purchases? I don't wanna buy this without knowing if it'll really work for what I want.

  • Urgent : How to get current user id

    Hello,
    fnd_global.user_id returns -1
    fnd_profile.get('user_id',x_user_id) return null
    can anyone help how to get current logged in user to apps.
    Regards,
    Dinesh.

    Hi Dinesh,
    You must also make sure you have initialised the app.
    If you run this from sqlplus then it will return -1.
    If however you run this from within a concurrent program then the user id will be returned.
    Try using this from sqlplus fnd_global.apps_initialize
    Eg.
    begin
    dbms_output.put_line(fnd_global.user_id);
    fnd_global.apps_initialize(user_id => 3551,
    resp_id => 1,
    resp_appl_id => 1);
    dbms_output.put_line(fnd_global.user_id);
    end;
    /

Maybe you are looking for

  • Touchscreen issue 14 b124us

    Hello, My touchscreen is not working, and I ran UEFI test, but when I run the component test, I cannot see touchscreen option.. On the tutorial it says to run the touchscreen test, but for me, after mouse the next option in optical drive.. What can b

  • Not picking up correct Exchange Rate

    Hi, I have some queries that are not picking up the correct exchange rates. The entries look like they are there in TCURR, but the query isn't using them. Is there any program that can run a DB consistency check on currency tables? Br, Sonni

  • Still images snap into focus

    I'm using a number of still images in my project. Upon export to QuickTime, the images look fuzzy until they've been on screen for a few seconds, at which point they snap into perfect focus. Searching the forums, I couldn't find an answer, though I d

  • Horizontal scrolling. Help with large images.

    Putting together a .pdf publication for iPad. I have content that fits a standard iPad format BUT I also have these very long timelines (170cm x 21 cm). These need to be displayed zoomed in -  with the reader swiping right to accessing the remainder

  • Widescreen/anamorphic

    Urgent help is needed please My video is filmed in DVPAL anamorphic with a XL1s We need to make animations between the clips and use motion for this. After creating an animation an adding black borders to get an anamorphic effect: selecting add filte