This discussion is archived
3 Replies Latest reply: Sep 12, 2012 3:34 AM by Faisal Khan RSS

weblogic authentication programatically

960172 Newbie
Currently Being Moderated
Hello Experts,

I have to authenticate the weblogic programatically ,as the client has deployed a serverlet in weblogic, and i have my web-application on the same weblogic.

my web application has a link , where it try to get a document from the archive server , thorugh the servlet . the web.xml for the server has <auth-method>BASIC</auth-method>

so from my web application when we click , now the pop-up/login/credential box is coming, I do have the credentials for this , as in the security realms the user is created.

I want to avoid this pop up and pass the credentials ,and do the authentication progrmatically.

all in my java I have a string URL="http://localhost:8080/servlet/xxxx?"

Can any1 suggest or let me know the feasible way

Edited by: Gkparis on Sep 11, 2012 2:03 AM
  • 1. Re: weblogic authentication programatically
    Kalyan Pasupuleti-Oracle Expert
    Currently Being Moderated
    Hi,

    As this is basic authentication process which do in-general.

    We have BASIC / FORM / Cert base.


    So I think Authentication is first process you need to fill if you want you can use SSO process to access with authentication every time in such case you can use certbase.


    check few examples.

    http://biemond.blogspot.in/2009/05/sso-with-weblogic-103-and-saml.html

    http://docs.oracle.com/cd/E23943_01/web.1111/e13707/saml.htm


    any further help let me know.

    Regards,
    Kal
  • 2. Re: weblogic authentication programatically
    960172 Newbie
    Currently Being Moderated
    Hi Kalyan,

    I am aware of the auth-method , my constraint is :

    Client has deployed this servlet aling with auth-method -BASIC and client dont want to change any thing in the web.xml or any other configuration changes

    So i am wondering , if this has to be achieved by programming way , maybe some wat like this url :

    http://docs.oracle.com/cd/E11035_01/wls100/security/thin_client.html#wp1035574

    still i am stuck because, i have a string strUrl="http://localhost:8080/servlet"

    and the API here
    weblogic.servlet.security.ServletAuthentication.runAs(mySubject, request);

    needs the request object

    Any pointer u can suggest !!!
  • 3. Re: weblogic authentication programatically
    Faisal Khan Expert
    Currently Being Moderated
    Socket s = new Socket("localhost", 7001);
    BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
    PrintStream out = new PrintStream(s.getOutputStream());
    out.println("POST /servlet/xxxx?");
    out.println("Accept-Encoding: gzip,deflate");
    out.println("Authorization: Basic d2VibG9naWM6d2VibG9naWM=");

    For e.g. if your username and password is weblogic,weblogic, you will have to create a string like this weblogic:weblogic then encode it using base64 and then pass it in the code..

    http://www.motobit.com/util/base64-decoder-encoder.asp

    Hope this helps!

    -Faisal

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points