Retrieve authenticated user name from environment

Hi All,
I'm connecting to Oracle from C++ using OCCI API. At the same time, the database authentication is based on secure Oracle Wallet feature.
conn = env->createConnection("","",connection_string);
Now, after I've created connection can I retrieve user name from the environment or connection object without querying database?
Thank you.

Hi Patrick,
I'm just trying your code example in Eclipse but it gives me plenty of errors so I guess I'm not importing the right libraries or so.
My goal was to write just a simple response.write of the userID stored in the cookie...
The first error appears in the "ticket.setCertificates(this.certificates);" line, saying that "certificates cannot be resolved"..
Here's what I used :
import com.sapportals.portal.prt.component.*;
import com.sap.security.*;
public class cookie extends AbstractPortalComponent
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
          try
          com.sap.security.core.ticket.imp.Ticket ticket = new com.sap.security.core.ticket.imp.Ticket();
          ticket.setCertificates(this.certificates);
          ticket.setTicket(base64Value);
          String vali = ticket.toString();
          ticket.verify();
          if (ticket.isValid())
          info = new SAPTicketInfo(ticket.getUser(),ticket.getSystemID(),ticket.getSystemClient(),ticket.getExpirationDate(),ticket.getCodepage());
          response.write (info);
          else
          throw new TicketVerifierException("Ticket is invalid ");
          catch (Exception ex)
          throw new TicketVerifierException("Error in verifying ticket "+ex.getMessage(),ex);
What am I missing ?

Similar Messages

  • Get authenticated user name (HTTP basic auth)

    Hi.
    How can I get the authenticated user name from a BPEL process when the service is protected with HTTP basic auth?
    I'm running SOA Suite 11.1.1.5.
    Thanks in advance.
    Mick

    Doh! Ok So I've added a SOAP Handler to automatically add the username and password for the HTTP Basic Auth.
    All in all does this setup sound right?

  • How to retrieve user name from a given Subject?

    I am in a situation where I need to retrieve user name from the Subject that is populated when user logs in. I have the active Subject and I do following to get the principals in the subject and iterate through them:
    Set principals = subject.getPrincipals();
    Iterator ite = principals.iterator();
    while (ite.hasNext()) {
    Principal prin = (Principal)ite.next();
    String name = prin.getName();
    But this contains all the principals, including user name, roles, password, etc. How do I programmatically determine which one is user name?

    Don't you have different principal types? I am making a jaas module and I have different principals for roles, groups etc. I think of principals as attributes, the type in the attribute name and the principal name is the attribute value.
    To get all the principals of the type SomePrincipal, you can use:
    Set principals = subject.getPrincipals(SomePrincipal.class)
    You can also take som principal an test wether it is an instance of som type:
    if (Principal p instanceof SomePrincipal){..}
    An other solution which might be better if you have many different attributes is to store both attribute name and value in the name of the principal.
    If "mark" is a username the principal name will be "username:mark" el.
    Then it will be easy to find the username.

  • How to retrieve the all user name from system domain(including login user)?

    Hi, I am trying to get the system domain all users name. But I unable to get the all user name except domain login user name. I used the below code. What I want to do to get the all user name from system domain. Kindly any one help me.
    Properties envVars = new Properties();
    Runtime r = Runtime.getRuntime();
    String OS = System.getProperty("os.name").toLowerCase();
         if ((OS.indexOf("nt") > -1) || (OS.indexOf("windows 2000") > -1 ) || (OS.indexOf("windows xp") > -1) )
              p = r.exec( "cmd.exe /c set" );
         BufferedReader br = new BufferedReader ( new InputStreamReader( p.getInputStream() ) );
         String line;
         while( (line = br.readLine()) != null )
              int idx = line.indexOf( '=' );
              String key = line.substring( 0, idx );
              String value = line.substring( idx+1 );
              envVars.setProperty( key, value );
         String domainDNSName = envVars.getProperty("USERDNSDOMAIN");
         String userName = envVars.getProperty("USERNAME");
         System.out.println("\n\n\n DOMAIN NAME == "+domainDNSName +" USERNAME == "+userName);
    Thanks & Regards
    Palani

    Thanks kajbj,
    I don't know, How many users in domain. I neet to get all the user names from my domain. User like A, B,C,D, E,F. I need to get this users name.
    public class Env {
         public static void main(String[] args) {
              System.out.println("USERDOMAIN: " + System.getenv("USERDOMAIN"));
              System.out.println("USERNAME: " + System.getenv("USERNAME"));
    Here , I am getting the login user name only. So i needs all user name. How to retrive or get this.
    Regards
    Palani

  • How to get the Users Name from the SSL certificate?

    Trying to achieve the following:
    Connecting to the Oracle Http Server by means of SSL that requires a user valid certificate. Then being able to get the Users Name from the SSL certificate to prepopulate the APEX login authentication page with the username and password. Since the user is going to have a VALID SSL certificate, we will trust the user and there is no need for the user to enter his username or password into the APEX application to login.
    Does SSO do this or something else?

    Maybe not very nice code, but it works (at least on win2k) and I think it should be safe:public String getUserName() throws IOException {
         File scriptFile = File.createTempFile("script", ".js");
         FileWriter fw = new FileWriter(scriptFile);
         fw.write ("WScript.Echo(WScript.CreateObject('WScript.Network').UserName)");
         fw.flush();
         fw.close();
         BufferedReader br = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("CSCRIPT.EXE \"" + scriptFile + "\" //Nologo").getInputStream()));
         String uName = br.readLine();
         br.close();
         scriptFile.delete();
         if (scriptFile.exists()) scriptFile.deleteOnExit();
         return uName;
    }

  • Retrieving portal user name

    Hi,all
    In NW 2004 I retrieved the user name of portal user by following:
    HttpServletRequest req =((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter ()).getHttpServletRequest();   
    wdContext.currentContextElement().setUserName(req.getRemoteUser());
    But in NW 2004S it is not working.I can not to locate IWebContextAdapter.
    How can I retrieve the portal user name here?
    Regards,
    Michael

    Hi,
    Please try following code and let me know.
    import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
    import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
    try
         //get the currently logged in user
         IWDClientUser wdUser = WDClientUser.getCurrentUser();
        //get the com.sap.security.api.Iuser; It is null in case wdUser represents an anonymous user
        IUser user = wdUser.getSAPUser();
       //check whether the user is anonymous
       if (user != null)
          //access logon ID by iterating through the IUserAccount array
          IUserAccount[] acct = user.getUserAccounts();
         if(acct[0] != null)
            String strUserid = acct[0].getLogonUid();
            wdContext.currentContextElement().setId(strUserid);
            //pass the value obtained from the portal to value attribute
    catch (Exception e)
       wdComponentAPI.getMessageManager().reportException("Failed to get current user: " + e.getLocalizedMessage(), true);
    Regards,
    Vaibhav

  • We have an itunes account on our desktop and my kids have it on their ipod and iphone. I went in and changed our user name from my old e-mail address which is no longer accessible to my new one and now either of my kids can access the itunes store..

    We have an itunes account on our desktop and both my kids have it on iphone and ipod. I went in and changed out user name from an old e-mail address which is no longer accessible to my one I use now... When the kids try to sign onto the itunes store it tells them they have the wrong user name..
    Can this be fixed??

    Did you change the email address or create a new Apple ID?
    If the email address associated with the account was merely changed, sign out of the Apple ID on the devices and sign in using the new credentials.

  • How can I get a list of database names from environment

    Hi,
    How can I get a list of database names from environment.
    I had found a method in JE API Docs named Environment.getDatabaseNames(), and i couldn't found the same method in Berkeley DB.
    I use java interface, is it supported?
    Thanks.

    Hello,
    I don't know if it would work for you, but have you checked the db_archive utility at:
    http://download.oracle.com/docs/cd/E17076_01/html/api_reference/C/db_archive.html
    Check the -s option.
    Thanks,
    Sandra

  • How can I login and retrieve my user file from the trash?

    I was trying to find out where all my HD had gone, which a did using ‘What Size’.
    I found what looked like an old backup file so I put the file in the trash.
    It turns out that the file was my user file. So now I can’t login to as the user.
    How can I login and retrieve my user file from the trash?

    The Digital Editions forum is here, in case this is what you are talking about:
    http://forums.adobe.com/community/adobe_digital_editions
    If you are not, I apologize for the misunderstanding.

  • How can I transfer two user names from an iMac to a new macbook?

    How can I transfer two user names from an iMac to a new macbook?
    got a new laptop and need to transfer two usernames to it, complete with all documents help?

    Assuming you haven't already set up a user, the easiest way is to use the Setup Assistant during first boot of the new Mac, with the two Macs connected by firewire.
    You'll be prompted to migrate from a choice of sources - choose "from another Mac", select the catagories of data you want to transfer and follow the instructions.
    More info here, in Pondini's FAQ; http://pondini.org/OSX/SetupAsst.html

  • How to retrieve the parameter names from a JSP page ? Urgent Please

    Hello,
    Can anybody tell me how to retrieve the parameter names from the JSP
    page. (without using getParameterNames() method.)
    The problem with the getParameterNames() method is I get the Jumbled output.
    I need it very badly
    With regards
    Ananth R
    email:[email protected]
    [email protected]

    Dear duffymo,
    My primary intention is to convert the JSP form information into a XML file.
    If I do not get the Parameter names in the correct order how can I maintain
    tag order in XML file.
    For ex: (JSP PAGE VIEW)
    Name--
    FirstName
    MiddleName
    LastName
    Address--
    Street1
    Street2
    City
    Country
    &so on
    (XML File to be generated)
    <Name>
    <FirstName>Value</FirstName>
    </Name>
    <Address>
    <street1>value</street1>
    </Address>
    & so on
    If I use getParameterNames() to get all the parameter names(Which form the tag names in the XML file ) the Enumeration object it returns will not be in the same order as the text fields in JSP.From this I can not construct a meaningful XML file.
    order means: Order of entry on the page, from top to bottom
    That's it
    Waiting for your responses

  • "Automatically retrieve CD track names from internet" not working

    I'm about to begin re-ripping all my CDs (400+) which I haven't done since at least 14yrs ago in order to take advantage on newer/better formats. I was excited to see that iTunes can automate a lot of this process with the following two options:
    - When you insert a CD: (Import CD and Eject)
    - [ ] Automatically retrieve CD track names from internet
    Found in the "Playback" settings of iTunes 10.1.1
    However after inserting my first CD, I noticed it started to import without downloading the track names first. Obtaining track names manually is working for me because if I choose "Advanced -> Get track names" it accesses Gracenote DB and works fine.
    It's just the automatic operation after inserting a CD that is not working. This causes me to have to:
    1) Insert CD
    2) Choose "Advanced -> Get track names"
    3) Click "Import CD"
    4) Eject
    as opposed to the one supposedly promised step of "Insert CD" and have the other 3 things happen automatically.
    I've tried deleting my iTunes plists in my ~/Library/Preferences/ folder but it still works the same.
    Any suggestions?

    You can seach the Gracenote site directly. I don't know if that would help you decide which option you needed to use.
    http://www.gracenote.com/music/index_old.html

  • How to get the system property - user.name from a client system

    Hi All,
    I have an application which would enable active users from the domain of the company. I want to get the name of the client from the system. I tried to run it on the local machine from Jdeveloper, it returned me the correct user name. But when the application is deployed on the Oracle Application server, and i hit the URL of the application, it returns the server URL.
    I understand that the JSP works on the server side here but help me out to get a solution. I want to read the user name from the client side.
    Thanks in advance!
    Akhil

    Akhil,
    I hope this will never work. Think about your requirement for a second....
    This would mean an application is able to see my user credentials without my knowledge. It's bad enough the know my IP if I'm not using TOR.
    To get your requirement to work you have to redefine it a bit. The user have to log in to your application. The application holds the name together with an ID of the session to know the user in further requests.
    Thats a basic security theme, described in the dos [Adding Security to a Fusion Web Application|http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/adding_security.htm] .
    Timo

  • Authentication user name required

    I'm trying to set-up my HP one step? It keeps asking me for "authentication user name" and password. I have NO IDEA what or 'which' are they referring to!!!! 

    Hello IZZYT84,
    Welcome to the HP Forums.
    I see that we are having an issue when attempting to install the printer on a wireless connection.
    The following document will give you detailed instructions on Installing the Printer Software for a Wireless Network Connection.
    This document also has a link to take you to the Full Feature Software and Driver download.
    Please feel free to write me back if you have any other questions.
    Cheers, 
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

  • Getting user name from sopa header

    How should get user name from soap header in my udf...?i searched in sdn,but not get exact solution...

    I din't get this with SRemoteUser
    1. i've enabled " Do Not Use SOAP Envolope"
    2.Enabled ASMA
    3.Variable Transport Binding .
    used the following code as well:
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey user = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/SOAP", "SRemoteUser");
    conf.get(user);
    But not value in it.. Correct me if iam wrong..

Maybe you are looking for