forms - programmatic authentication in JSF 2 brings auth pop-up -


for our web app (running on websphere 8.5) using programmatic login using basic http authentication suggested in (https://stackoverflow.com/a/2207147/2683081) i.e. servlet 3.0 httpservletrequest#login().

after login using our application login page, keep getting 2nd log-on screen message

the server __ @ default realm required username , password

is there way avoid getting standard windows security pop-up.

i tried set response headers authorization no luck.

update:- application on mojjaro jsf 2.1.28 on websphere8.5 ldap security

       <?xml version="1.0" encoding="utf-8"?>     <web-app version="3.0"         xmlns="http://java.sun.com/xml/ns/javaee"         xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"         xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" >       <display-name>test</display-name>       <welcome-file-list>         <welcome-file>index.jsf</welcome-file>       </welcome-file-list>        <!-- spring -->         <listener>         <listener-class>                 org.springframework.web.context.request.requestcontextlistener             </listener-class>       </listener>       <listener>         <listener-class>                 org.springframework.web.context.contextloaderlistener             </listener-class>       </listener>       <!-- end spring-->       <context-param>             <param-name>javax.faces.interpret_empty_string_submitted_values_as_null</param-name>             <param-value>true</param-value>       </context-param>             <context-param>               <param-name>com.sun.faces.expressionfactory</param-name>          <param-value>org.jboss.el.expressionfactoryimpl</param-value>           </context-param>         <listener>             <listener-class>com.sun.faces.config.configurelistener</listener-class>        </listener>         <context-param>             <param-name>javax.faces.state_saving_method</param-name>             <param-value>server</param-value>         </context-param>          <context-param>              <param-name>javax.faces.partial_state_saving</param-name>              <param-value>false</param-value>          </context-param>            <!-- faces servlet -->         <servlet>             <servlet-name>faces servlet</servlet-name>             <servlet-class>javax.faces.webapp.facesservlet</servlet-class>             <load-on-startup>1</load-on-startup>         </servlet>         <servlet-mapping>             <servlet-name>faces servlet</servlet-name>             <url-pattern>*.jsf</url-pattern>         </servlet-mapping>          <context-param>             <param-name>primefaces.theme</param-name>             <param-value>casablanca</param-value>         </context-param> <security-constraint>         <display-name>constraint-0</display-name>         <web-resource-collection>             <web-resource-name>constraint-0</web-resource-name>             <description/>             <url-pattern>/test/*</url-pattern>         </web-resource-collection>         <auth-constraint>             <description/>             <role-name>admin</role-name>             <role-name>guest</role-name>         </auth-constraint>     </security-constraint>     <security-role>     <role-name>admin</role-name>     </security-role>     <security-role>     <role-name>guest</role-name>     </security-role>       <!-- mime mapping -->         <mime-mapping>         <extension>png</extension>         <mime-type>image/png</mime-type>         </mime-mapping>     </web-app> 

login.xhtml

<h:form id="login">                      <div class="inputlabel">         <h:outputlabel for="username" value="login:"/>     </div>     <div>         <h:inputtext value="#{loginbean.username}" id="username" size="25" />     </div>     <div class="inputlabel">         <h:outputlabel for="password" value="password:"/>     </div>     <div>         <h:inputtext value="#{loginbean.password}" id="password" size="25" />     </div>     <div>         <h:commandbutton action="#{loginbean.login}" value="login" />     </div>                   </h:form> 

loginbean.java

public string login() throws ioexception {     facescontext context = facescontext.getcurrentinstance();     externalcontext externalcontext = context.getexternalcontext();     httpservletrequest request = (httpservletrequest) externalcontext.getrequest();     try {                request.login(username, password);                     return "/testing/index.jsf?faces-redirect=true";     } catch (servletexception e) {                context.addmessage(null, new facesmessage("invalid login!!!"));             } } 


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -