Get UserName / Userid Connected

Hello guys,
Im' trying to get the name of the user currently connected in my app for using this username as a bind variable in a view object Query.
I have set "Authentication type" and "Authorization type" to "Custom", so I have an administration module. Authentication use the JHS_USERS table, and it's work fine.
But I don't understand how to get, from an expression or form a JAVA class, the username or the user id of the user who is currently connected.
I think I have to get the jhsUser context, but no idea to how can to do it.
I have tried with adf security, but the username return is empty, and I think it's because I use custom methods, and not JAAS / ADF.
As anybody can explain to me please ? I had seen it's possible to override hte loginBean by create a DoCustomAuthentication method. Do I have to implement this method to save the username in the session context and to get it after in a other class ? If yes, how can I do it ? (because I don't find how to implement a new method in the LoginBean)
Thank you
Paul

Ok, I have find the solution :
try {
JhsUser jhsUser = (JhsUser)JsfUtils.getFromSession(JhsUser.JHS_USER_KEY);
System.out.println("USERNAME and ID : " + jhsUser.getDisplayName() + " - " + jhsUser.getUserId());
} catch (Exception e) {
System.out.println("ERREUR : " + e.toString());
Paul

Similar Messages

  • Error while applying a patch "Unable to get the database connection"

    Dear Experts,
    A patch which got successfully applied is failing Production and the error is kind of surprising to me.
    Apps version is 11.5.10.2
    db version is 10.2.0.4
    The worker log file shows
    Time when worker restarted job: Thu Nov 24 2011 22:14:52
    Start time for file is: Thu Nov 24 2011 22:14:52
    adjava -ms128m -mx256m -nojit oracle.apps.fnd.odf2.FndXdfCmp &un_apps &pw_apps &un_apps &pw_apps &jdbc_protocol &jdbc_db_addr table &fullpath_pa_patch/115
    Reading product information from file...
    Reading language and territory information from file...
    Reading language information from applUS.txt ...
      Temporarily resetting CLASSPATH to:
      "/erp/oracle/prodappl/ad/11.5.0/java/adjri.zip:/usr/java14/jre/lib/charsets.jar:/usr/java14/jre/lib/core.jar:/usr/java14/jre/lib/graphics.jar:/usr/java1
      Calling /usr/java14/bin/java ...
    Exception occured
                  Copyright (c) 2003 Oracle Corporation
                     Redwood Shores, California, USA
             XDF(XML Object Description File) Comparison Utility
                            Version 1
    NOTE: You may not use this utility for custom development
          unless you have written permission from Oracle Corporation.
    Unable to get the database connection using schema username/passwordIo exception: The Network Adapter could not establish the connection
    AD Run Java Command is complete.
                         Copyright (c) 2002 Oracle Corporation
                            Redwood Shores, California, USA
                                        AD Java
                                     Version 11.5.0
    NOTE: You may not use this utility for custom development
          unless you have written permission from Oracle Corporation.
    AD Worker error:
    The above program failed.  See the error messages listed
    above, if any, or see the log and output files for the program.
    Time when worker failed: Thu Nov 24 2011 22:14:53
    {code}
    The error says database connection error.  I am able to connect to the database using sqlplus.  I tried to restart the failed worker, but the same error is repeating. 
    Any help would be appreciated.
    Thanks
    qARS
    Edited by: user7640966 on Nov 24, 2011 9:07 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hussein,
    One thing which I noticed now is in the apps Tier the
    tnsnames.ora under $TNS_ADMIN
    shows entry like this:
    PROD=
            (DESCRIPTION=
                    (ADDRESS=(PROTOCOL=tcp)(HOST=<appsServerName>)(PORT=1521))
                    (ADDRESS=(PROTOCOL=tcp)(HOST=<dbServer>)(PORT=1521))
                (CONNECT_DATA=
                    (SID=PROD)
            )Actually *(ADDRESS=(PROTOCOL=tcp)(HOST=<appsIPaddress>)(PORT=1521))* this line in the tnsnames.ora is not correct. In fact the appsServerName should be replaced with dbServerName
    I deleted the tnsnames.ora and reran autoconfig but it is again recreating the same entry.
    Any clue how this can be fixed?
    Thanks
    qARS

  • User gets "This network connection does not exist" when she tries to log on to Terminal Server (2008 R2)

    User gets "This network connection does not exist" when she tryes to log on to Terminal Server (2008 R2)
    I got more than 100 users. Shes the only one getting is. We tried four computers (All Windows 7 Pro)
    Nothing useful in event viewer to mention.

    Hi,
    Thank you for posting in Windows Server Forum.
    Does that user able to login previously?
    From your comment, it seems that there is some permission issue with that user. As you have checked that user with different system also. Please check that user is added under “Remote Desktop User” local group and also allowed “Allow log on through
    Remote Desktop service” permission under group policy. Also please check that when user tries to login it uses “Domainname\Username” format.
    In addition for a try, also check by disabling firewall on one particular system.
    To add users and groups to the Remote Desktop Users group by using Local Users and Groups snap-in:
    1.  Click Start > Administrative Tools, Open Computer Management.
    2.  In the console tree, click the Local Users and Groups node.
    3.  In the details pane, double-click the Groups folder.
    4.  Double-click Remote Desktop Users, and then click
    Add.
    5.  In the Select Users dialog box, click Locations to specify the search location.
    6.  Click Object Types to specify the types of objects you want to search for.
    7.  Type the name you want to add in the Enter the object names to select (examples) box. 
    8.  Click Check Names.
    When the name is located, click OK.
    More information:
    Remote Desktop disconnected or can’t connect to remote computer or to Remote Desktop server (Terminal Server) that is running Windows Server 2008 R2
    http://support.microsoft.com/kb/2477176/en-us
    Hope it helps!
    Thanks,
    Dharmesh

  • Trying to get new house connected is a nightmare

    Hi,
    Just moved house in September and made arrangements to get my phone and broadband service moved to my new address, got an appointment for the 25th and after numerous e-mail and texts to say they were coming and to make sure someone would be in they called the night before to cancel stating external works would need done and i would get an update in two weeks, bearing in mind the previous owner had a phone line, there is a pole outside the front door with a cable going to my house i was shocked when told there wasn't a line available for me from the pole or any other close by, anyway this has been going on for some time now, first they submitted drawings to the council for 3 way traffic lights that were accepted, then when the work was supposed to be carried out they came back with another excuses saying they then had to then submit plans to the council, we then got another date for 12th November and was assured that most of the cable work was complete and only a small section remained that was underground and requiring the traffic lights would take an hour, 3 men turned up hovered around outside the house and then disappeared again before i could get my shoes on and go out to chat to them, then told the following day that they could not complete the work for some reason that the cs girl didn't know then got a date for the 19th that was then changed later to the 24th then at 4am this morning get an email from BT saying they would be sending an engineer on the 25th September - whats that all about!! its getting beyond a joke i'm usually pretty patient but this is getting ridiculous, and to top it all off i am still getting charged for the services that havent been getting for the last two months.
    Mark

    Hi Markyd1973,
    Welcome to the forum and thanks for posting. I'm sorry about the delay getting your line connected please use the 'contact the mods' link in my forum profile under the 'about me' section to send in your details and we'll check with Openreach for an update. You can find the link by clicking on my username.
    Thanks
    Neil
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • I can't get bitlbee to connect to gmail in irssi

    I've been going round in little circles trying to get bitlbee to connect to gmail in irssi. I've followed numerous tutorials, seen a bunch of different sites, and everything fails at an Authentication Failure message. I can connect to gmail from centerim, so I'm getting out on the network. Would someone please let me know what needs to be done to get this to work? By the way, I also tried the irssi-xmpp plug-in  to no avail.

    Mine also says password is empty.  Full output below in case it helps. (email backwards for the stupid bots.)
    rsontech > account set 2
    root > auto_connect = `true'
    root > auto_reconnect = `true'
    root > password is empty
    root > username = `[email protected]'
    root > port = `5222'
    root > priority = `0'
    root > resource = `BitlBee'
    root > resource_select = `priority'
    root > server = `talk.google.com:5223:ssl'
    root > ssl = `false'
    root > tls = `try'
    root > xmlconsole = `false'
    EDIT:  I've also fixed my link above.  The author's permalinks seem to not be working.
    Last edited by rson451 (2009-03-30 01:16:24)

  • When try to get mail it says "cannot get mail, the connection to the server failed, how to fix?

    when try to get mail it says "canot get mail, the connection to ther server failed", how do I fix this issue?

    Check your username, password and account settings for that email account.
    If they all look right, then try deleting the account, and re-adding it.

  • IPad 2 and iPhone 4 - can't get an internet connection while tethered

    I have an iPad 2 and an iPhone 4. Been using the iPhone to tether my iPad for a few weeks and all of a sudden when it's tethered I can't get an internet connection. Both iPhone and iPad are updated with latest software.

    Hello Emma I presume your in the UK.
    In the UK PPPoA is the standard PPPoE is not supported by many ISP's.
    On your Mac just use DHCP in your Network settings. Do not use PPPoE.
    Then login to your router's web configuration page. http://192.168.0.1 or http://192.168.1.1. Admin and Password are the usual login details for netgear routers.
    use the following details
    PPPoA
    VC-Mux
    Chap authentication
    vpi and vci are 38,0
    and of course use your isp username and password.
    Post edited. I just noticed you had already figured out the correct details.
    Message was edited by: Tim Haigh

  • An error occurred while getting property "userId" from an instance of class

    Running application SRDemo (Tutorial Chapter 6 Implementing Login Security)
    After logging, the List page popped up. But no data returned. Get Error
    JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: java.lang.RuntimeException, msg=javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.srdemo.view.UserInfo.
    Questions:
    1. What are possible reasons to cause the getting property "userId" problem?[
    2. Why the Login page asked User Name and Password and the program used the query with "WHERE (EMAIL = 'sking')"
    The Log file shows the select statement:
    SELECT USER_ID, FIRST_NAME, LAST_NAME, CITY, POSTAL_CODE, EMAIL, STATE_PROVINCE, COUNTRY_ID, STREET_ADDRESS, USER_ROLE FROM USERS WHERE (EMAIL = 'sking')
    [TopLink Info]: 2006.11.08 11:07:09.468--ServerSession(1235)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--SRDemoSession login successful
    [TopLink Finer]: 2006.11.08 11:07:09.468--ServerSession(1235)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--client acquired
    [TopLink Fine]: 2006.11.08 11:07:09.500--ServerSession(1235)--Connection(1925)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--SELECT USER_ID, FIRST_NAME, LAST_NAME, CITY, POSTAL_CODE, EMAIL, STATE_PROVINCE, COUNTRY_ID, STREET_ADDRESS, USER_ROLE FROM USERS WHERE (EMAIL = 'sking')
    [TopLink Finer]: 2006.11.08 11:07:09.578--ClientSession(2021)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--client released
    [TopLink Finer]: 2006.11.08 11:07:09.625--ServerSession(1235)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--client acquired
    [TopLink Fine]: 2006.11.08 11:07:09.625--ServerSession(1235)--Connection(1922)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--SELECT USER_ID, FIRST_NAME, LAST_NAME, CITY, POSTAL_CODE, EMAIL, STATE_PROVINCE, COUNTRY_ID, STREET_ADDRESS, USER_ROLE FROM USERS WHERE (EMAIL = 'sking')
    [TopLink Finer]: 2006.11.08 11:07:09.625--ClientSession(2027)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--client released
    2006-11-08 11:07:09.640 WARNING JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: java.lang.RuntimeException, msg=javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.srdemo.view.UserInfo
    2006-11-08 11:07:09.640 WARNING JBO-29000: Unexpected exception caught: java.lang.RuntimeException, msg=javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.srdemo.view.UserInfo
    2006-11-08 11:07:09.640 WARNING javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.srdemo.view.UserInfo
    2006-11-08 11:07:11.515 WARNING rowIterator is null
    2006-11-08 11:07:11.515 WARNING rowIterator is null
    Process exited.

    Hi,
    I got the answer to my question. The tables were not populated. So I ran the script - populateSchemaTables.sql, and got the data into the tables. The error is gone!
    Lin

  • How do I get an itunes connect account

    how do I get an itunes connect account

    Since I don't haven't signed up for iTunes Connect, I don't know exactly. There is a link at the top of the discussions for iTunes Connect: https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/wa/bookSignup

  • How to get SSO userid to URL-based app?

    I'm developing a web-app using Struts that will be accessed by Portal (I guess as a URL-based app). The web-app will not require login. The web-app will not be Portal "aware", except that it requires the SSO userid for auditing/logging purposes.
    I know little about Portal and SSO. How can Portal be configured to send the Portal userid of the logged-in Portal user? Can it send it as a parameter in a GET or POST?
    The version of Portal will be 9.0.2 (or greater).

    This topic is answered in the PDK forum here:
    How to get SSO userid to URL-based app?

  • When I go into app store on iPod touch and click on an app i get can't connect to iTunes

    I noticed it on jan 1 but was working fine on dec28 when I bought it. All I have done is download apps I had previously purchased on my old 3G iPod 32gb touch To my 5g 32gb iPod touch using purchases on the update part of app store. Please help me do I need to return it or can I fix it. Like I said everything else is working fine i just can't view app pages to tell how big an app is or anything about the apps.

    Mine had a SIM in it. Originally, when I took out the SIM and tried to restore it with nothing in it, it wouldn't work without a SIM card. So ... I took the SIM that was in that phone previously, put it back in and completed the system restore. I then proceeded to go through the process with AT&T of adding a data plan, which I did, and then it successfully completed the system restore. However, now if I run diagnostics on it, it will not verify ITunes Store. If I try to connect to ITunes store, I'll get the network connection timed out error I referenced earlier in this thread. I'm considering jailbreaking it and putting on an earlier software version. Your thoughts?

  • Hey my brother just got an ipod touch and i can't get it to connect to itunes what to i do he's really excited HELP!! :)

    hey my lil brother just got an ipod touch and its saying connect to itunes and its plugged into my computer and im at the itunes website but i can't get it to connect can anyone HELP ME??!! my mom said that she wants his ipod to be connected so that its on my itunes account so i can see if he buys anything.
                                       PLEASE HELP ME !!!
    ~Maddie

    iOS: Device not recognized in iTunes for Windows
    iPhone, iPad, iPod touch: Device not recognized in iTunes for Mac OS X
    If you  have iTunes 11 turn on the Sidebar.  Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar

  • Just brought home my IPad. I have the MIFI on and it is bringing in a signal to my IMAC but I can't get it to connect to my IPad. Any suggestions?

    I just brought my IPad home but can't get it to connect to my MIFI. The MIFI is on and working as it's sending a signal to my IMac. How do I get it to recognize the MIFI so I can go online with my IPad?

    Does your iPad see you network?  If no, are you broadcasting its SSID?

  • I am trying to use Words with friends on my iphone 5.  How do I get rid of   "Connect to itunes to Use Push Notifications

    I am trying to use Words with friends on my iphone 5.  How do I get rid of   "Connect to itunes to Use Push Notifications

    Reading some older threads from 2012 and 2011 it appears the problem was present even then.  Part of the problem was due to people using multiple or different account id's on the various devices.  In my case, I only have one ID and it is the same on all devices yet the iPhone and iPad are still throwing the same error when I try turning on iTunes Match.  This is very frustrating . . . any help out there?  Thanks.

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: 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
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

Maybe you are looking for