Showing posts with label ADF Security. Show all posts
Showing posts with label ADF Security. Show all posts

Tuesday, July 9, 2013

ADF 11G : How to Implement Logout ?

ADF 11G : How to Implement Logout ?

    public String logOut()  throws IOException{
        HttpSession session = null;
          FacesContext fctx = FacesContext.getCurrentInstance();
          ExternalContext ectx = fctx.getExternalContext(); 
          session = (HttpSession)ectx.getSession(false);
          HttpServletResponse response = (HttpServletResponse)ectx.getResponse(); 
              String currentPage = "faces/logout.jspx";
          String url = ectx.getRequestContextPath()+"/adfAuthentication?logout=true&end_url=" + currentPage;     
          try { 
             response.sendRedirect(url); 
              session.invalidate();
        
          } catch (Exception ex) { 
             ex.printStackTrace(); 
          } 
          fctx.responseComplete();
          return null; 
      }

Thursday, January 19, 2012

ADF 11G : How to Check the Existing User, Programatically?

Put the below code to AMImpl.java & Expose it as Client Interface:
------------------------------------------------------------------

public boolean isExistingUser(String userName,String password){
try {
ViewObjectImpl vo = getTestusersView1();
RowSetIterator itr = vo.createRowSetIterator(null);
while (itr.hasNext()) {
Row row = itr.next();
if (row.getAttribute("Username").equals(userName) &&
row.getAttribute("Password").equals(password)) {
return true;
} //end if


} //end while
} catch (Exception e) {
e.printStackTrace();
}
return false;
}