How to make Login Page in ADF?

Hi,
Can anyone suggest me, how to make Login Page in ADF.
I am new on ADF, is any sample code or application is there than it will be helpful for me.
please reply its urgent.
Thanks,
Ramit Mathur

HI,
Jspx code
<af:panelFormLayout id="pfl1" binding="#{loginBean.mainForm}">
<f:facet name="footer"/>
<af:inputText label="Username" id="it1"
value="#{loginBean.username}"
binding="#{loginBean.usernameId}"
required="true"/>
<af:inputText label="Password" id="it2" secret="true"
value="#{loginBean.password}"
binding="#{loginBean.passwordId}"
required="true"/>
<af:spacer width="1px" height="20px" id="s3"/>
<af:panelGroupLayout id="pgl3">
<af:commandButton text="Submit" id="cb1"
action="#{loginBean.doLogin}"/>
<af:spacer width="85px" height="1px" id="s4"/>
<af:commandButton text="Cancel" id="cb2"
action="#{loginBean.clearFields}"/>
</af:panelGroupLayout>
</af:panelFormLayout>
BackingBean code
public String doLogin() {
String un = _username;
String pw = _password;
// byte[] pw = _password.getBytes();
FacesContext ctx = FacesContext.getCurrentInstance();
System.out.println("ctx" + ctx);
HttpServletRequest request =
(HttpServletRequest)ctx.getExternalContext().getRequest();
CallbackHandler handler = new SimpleCallbackHandler(un, pw);
System.out.println("Handler" + handler);
try {
Subject mySubject = Authentication.login(handler);
System.out.println("mySubject" + mySubject);
ServletAuthentication.runAs(mySubject, request);
ServletAuthentication.generateNewSessionID(request);
String loginUrl =
"/adfAuthentication?success_url=/faces" + ctx.getViewRoot().getViewId();
System.out.println("loginUrl---" + loginUrl);
HttpServletResponse response =
(HttpServletResponse)ctx.getExternalContext().getResponse();
System.out.println("response---" + response);
// loginUrl = "/adfAuthentication?success_url=/faces/WelcomeScreen1.jspx";
sendForward(request, response, loginUrl);
System.out.println("---" + response);
} catch (FailedLoginException fle) {
FacesMessage msg =
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Incorrect Username or Password",
"An incorrect Username or Password" +
" was specified");
ctx.addMessage(null, msg);
} catch (LoginException le) {
reportUnexpectedLoginError("LoginException", le);
return null;
private void sendForward(HttpServletRequest request,
HttpServletResponse response, String forwardUrl) {
FacesContext ctx = FacesContext.getCurrentInstance();
System.out.println("sendForward--ctx--" + ctx);
RequestDispatcher dispatcher =
request.getRequestDispatcher(forwardUrl);
System.out.println("sendForward--dispatcher--" + dispatcher);
try {
dispatcher.forward(request, response);
} catch (ServletException se) {
reportUnexpectedLoginError("ServletException", se);
} catch (IOException ie) {
reportUnexpectedLoginError("IOException", ie);
ctx.responseComplete();
// 12.Implement a reportUnexpectedLoginError() method:
private void reportUnexpectedLoginError(String errType, Exception e) {
FacesMessage msg =
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Unexpected error during login ",
"An incorrect Username or Password" +
" was specified");
FacesContext.getCurrentInstance().addMessage(null, msg);
e.printStackTrace();
}

Similar Messages

  • How to make login page navigate to last visited page?

    Hi,
    In our application, there are many public pages. In certain page, users need to login and then add or edit something. But login page will navigate to page 1 by default. Uses need to click some times to locate the last visited page.
    I defined a new applicate item "LASTPAGE", and a new application process "setpage":
    begin
    if :APP_PAGE_ID!=101 then
    select :APP_PAGE_ID into :LASTPAGE from dual;
    else
    select 1 into :LASTPAGE from dual;
    end if;
    end;
    "setpage"'s process point is "On Load: Before Header(page template header)"
    In login page 101, log in process is like following:
    wwv_flow_custom_auth_std.login(
    P_UNAME => :P101_USERNAME,
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => v('APP_SESSION'),
    P_FLOW_PAGE => :APP_ID||':'||:LASTPAGE
    But the thing is it does not work. Log in page still go to page 1.
    Best regards,
    Qiang.
    Message was edited by:
    user535779

    Hi Scott,
    I would like to branch at the page that I am trying to get to from page 101.
    Let say page 12 Requires Authentication
    When I am not logged in , and I try to access Page 12 , I get branched to page 101 (login page).
    Now , from page 101 , I would like to branch to the page I was trying to access , in this case Page 12
    wwv_flow_custom_auth_std.login(
    P_UNAME => :P101_USERNAME,
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => v('APP_SESSION'),
    P_FLOW_PAGE => :APP_ID||:APP_PAGE_ID
    The problem is that APP_PAGE_ID contains 101 and not 12
    Francis.

  • How to make login page??

    hi expert ADF developer,
    I am using oracle ADF 11.1.2.2.0 (oracle Jdevelopr 11g release 2) in my job environment. There are 3000 users working as client level in our company. They have separated user Id. They can change their passwords.passwords which is handle by in database level.
    My main problem is how we can handle number of employees using Oracle ADF security configuration.
    second one is how user can change their passwords.
    Third is how number of employees going to terminate ,handle their Active/Inactive State.
    Fourth one is If we use this Oracle Security system ,project managers or project cordinator or Adminstrator level authenticator must need to deploy time to time war file, because of adding removing users in jazn-data.xml.
    hoping help from you.

    Duplicate :
    Oracle ADF Security Login page

  • ADF-UIX... How to make a page expire

    Dear sirs...
    is it possible to make every page in ADF UIX application expire?
    meaning when i am in page A and go to page B, if i click the browser Back button i would like to get the page expire warning.
    is this possible in JDeveloper 10.1.2.1???
    thanks in advance
    best regards

    Dear sirs...
    is it possible to make every page in ADF UIX application expire?
    meaning when i am in page A and go to page B, if i click the browser Back button i would like to get the page expire warning.
    is this possible in JDeveloper 10.1.2.1???
    thanks in advance
    best regards

  • How to disable login page in an application

    how to disable login page in an application

    Hi Alekh,
    To turn off authentication you must create and make current a No Login Authentication authentication scheme.
    or change Page / Security / Authentication as "Page is Public"
    Regards,
    Benz

  • How to make a page break in numbers

    The only way I found to make a new page in Numbers was to make new rows down to where the page would break, but it's only letting me add a few new rows to the new page.  I'd like to know how to make a page break without just adding rows.

    Hi Yellowbox,
    Still I'm not convinced, it gives you indeed some advantages but this page break is a great fault.
    All the company is working on Apple, we try even to keep Microsoft away but what when you make a quote of several pages and have to make your lay out at the end, it is a pain in your xxx to make it well.
    We cannot make different tables for each page nor I want to make it in Pages with a Numbers table.
    Secondly, what do you do when you get a Excell offer that you want to bring to Numbers.
    It opens well but again, you need to make all the page lay out afterwards!
    Thanks for yoru reply.
    It won't change my mind about Apple and Microsoft but for timing earning I won't changes all Excel offers to Numbers anymore. Even if I do not want, it would take me less time to work it out in Excel.
    Our own offers will remain in Numbers ...
    It is a pity but time is so important nowadays!
    Nice week-end.

  • How to make turning page with ibooks author?

    How to make turning page with ibooks author?

    This question has been answered on this thread
    https://discussions.apple.com/message/17981772#17981772#17981772
    Best regards.
    Alex

  • How to make a page header

    how to make a page header

    Lynn,
    Numbers 3 currently doesn't have page headers.
    However, there are some workarounds that can achieve the effect of having headers (though, for footers, you're limited to page number).  See this in Print Preview:
    You can set up extra Header Rows in your table and have them repeat on each printed page. The Table Name only shows on the first printed page, so you may want to uncheck Table Name before printing:
    See this thread for an example of how this workaround worked for one user.
    SG

  • How to make a page reload

    Hi every body, and thank you for reading my post, here's the question I have
    Does anybody know how can I make a page reload???
    Thank's

    If you mean how to make the page reload when someone pushes a button or clicks an action component such as a hyperlink, then have that component's action method return null. To create the action method for a component, double click the component in the Visual Designer.
    To make the page reload after someone selects from a drop-down or list, or when the user changes the value in an input text field, right-click that component and choose Auto-Submit on Change.
    Chris

  • When the page will be load how to make the page blank in run time

    Dear
    when i will run the page the fields shoud come with blank Field.
    i want to make it in runtime.
    example- i have one page having employees data. but when i will run that page the data will not come only blank fields should come, after thar i will create.

    duplicate how to make the page blank field in runtime

  • How to create Login page in Jdev11.1.1.4

    Hi All,
    can anyone please share how to create Login Page in Jdev11.1.1.4
    TIA,
    Bob
    Edited by: Bob on Feb 18, 2011 12:40 AM

    Bob,
    [url http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/adding_security.htm#BABDEICH]The documentation tells you how.
    John

  • How to make the page expired when user click back

    how to make the page as expired when i click back button on the browser.
    i want a better way.
    actually i have a timer.when it reaches 00.00 then the expired page will be called automaticlly using location.href="expired.jsp" then if the user clicks back it should not show the previous page.this concept is applied with paging concept
    response.setheader is not working ...
    i have redirect when click back using
    <body onunload>....i call another page here.
    but it is not a good way.
    so pls help me to solve this problem
    using session or another good way

    Use this instead.
    Frame.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

  • How to pass parameter from SSO login page to ADF application page?

    We have ADF-JSF application (running on AS 1013) that is being protected by OID running on AS 1012. SSO login page contains (among others) paramter ssousername and I wish to pass this to my ADF application. For the testing purpose I created ADF application entry point page that has something like this:
    <h:outputText value="#{param.ssousername}"/>and my sso login page has:
    <input type="text" size="30" maxlength="50" name="ssousername" value="<%=str_user%>">OID and ADF OC4j are running on two different servers, same network.
    So after successful login, when my page displays param passed is NULL?!
    Why?

    I solved it with the following....when my page loads, I execute test method:
        public void processLogin(String ssousername) {
             Object o  = JSFUtils.getUserFromSSOLogin();
             if (o!=null) System.out.println(o.toString());
        public static Object getUserFromSSOLogin(){
            FacesContext ctx = FacesContext.getCurrentInstance();
            return ctx.getExternalContext().getRemoteUser();
        }

  • How to make Login in php and PHPMYSQL

    HI ALL ,,     
    i am new in dreamweaver .. so i  made an login page in dreamweaver Cs4 but it looks like it dosent  have what i want .. i want to write the usrname  after the user login "" when he enter the username and the password right then login form  disappear and show "" Welcome username "" and how many visits did he do"" also I want to make forget password and send mails from time to other and send him mail when the user register and so on so can  you please help me ... thanks
    thank you please I need this very much

    hi i know that i am not good in php
    But when i did what you told me in this link it appears that i didn't get it or there is something wrong
    this error shows to me ...
    Notice:  Undefined variable: row_getUserDetails in E:\wamp\www\......\H.L\j.\tagarob 1.php on line 52
    Notice:  Undefined variable: row_getUserDetails in E:\wamp\www\......\H.L\j.\tagarob 1.php on line 52
    Welcome,
    thank you
    kareem

  • How to make multi-page PDFs?

    A question on this in the Archives did not answer my problem. Until recently, I could easily make multipage PDFs from Pages on my iMac (10.8.4). Now suddenly it only makes a PDF of the first page of multi-page files. Cannot find anyplace to change that back. HOW do I make multi-page PDFs again?

    Check this portion of your code.
    if(rs.next())
       response.sendRedirect("02_dashboard_welcome.jsp");
    else
      out.println("Wrong username or password");Once the user is authenticated(valid username and password found), he is always redirected to a particular page no matter what kind of user he is. You need to add some if-conditional and redirect him to different pages based on his role.
    i have stored their login and password in different tablesI don't understand the need to create different tables for each kind of users. Rather i would do something like this.(Rough Schema)
    USER_ROLE(table)
    1. USER_ROLE_ID (Eg: 1:salesperson, 2:employees etc)
    2. DESC (Eg: salesperson, employees)
    USER TABLE
    1. USER_ID
    2. USER_NAME (Eg: AAA)
    3. PASSWORD (Eg: BBB)
    4. USER_ROLE_ID<Foreign Key, 1 if user is sales person, 2 if user is an employee etc>
    Please note that you will have to create a third table to assign role to an user if an user can have more than
    one role ie he can be salesperson and employees at the same time.
    Now use USER_ROLE_ID to redirect the user to different pages.
    Note: This is just an example(may be a worst one). please design your database and business logic as per your requirements.

Maybe you are looking for

  • Error in invoking target install of makefile: Oracle8.1.6 on RHLinux7.1

    Hello, How are you? I am facing some problem to install Oracle 8.1.6 on my own pc on os Linux 7.1. I can start installer.Its installing but after 72% installation complited than its gives following errors. error in invoking target install of makefile

  • Transfering photos from old laptop to new with different versions of PS elmnts

    We have PS Elements 4 on an old lap top, running Windows Vista, which is beginning to fail. Have just purchased new lap top running Windows 8 which will not accept PS Elements 4 as it is incompatible, but it has partially loaded. Shop says they trans

  • Creating a report of all the errors occured while loading legacy data

    hi  guys, i am using Bapi to load legacy data . how can i  list all the errors that occur during the transfer . i want to see  all the errors that occured and  create a report . thanks .

  • I'm having trouble installing CS6 beta;

    I'm having trouble installing CS6 beta; when I try, it says to close background processes - specifically Bridge, which is NOT open. In fact, I just turned the computer on and tried to install what was dowloaded last night. Any ideas? LM

  • Could Not Proxy For User

    I try to use Methods Proxy from the Object API, but I got this error : "Could Not Proxy For User", my client version is 7.0.3 . With the Novell Groupwise Client I can access to the proxy account. Any idea of what to do to fix this problem ?