Package javax.servlet.http

Examples of javax.servlet.http.HttpServletRequest.login()


         try
         {
            //only perform a login if the user is not already authenticated
            if (request.getRemoteUser() == null)
            {
               request.login(username, password);
            }
         }
         catch (ServletException e)
         {
            // FIXME
View Full Code Here


       
       
        String uname = request.getParameter("username");
        String pword = request.getParameter("password");
        try {
        request.login(uname, pword);
        request.authenticate(response);
        } catch(ServletException se) {
            request.setAttribute("authenticationMessage", "Login failed.");
            Logger.getLogger(actions.LoginAction.class.getName()).log(Level.INFO, "Login Failed for User ID: "+uname);
            return("fail");
View Full Code Here

        if(username == null) {
            chain.doFilter(request, response);
            return;
        }
        try {
            req.login(username, password);
            chain.doFilter(request, response);
        } catch (ServletException e) {
            ((HttpServletResponse)response).setStatus(StatusCodes.UNAUTHORIZED);
        }
    }
View Full Code Here

        if (session != null && session.getAttribute(CONST_CAS_ASSERTION) == null && ticket != null) {
            try {
                final String service = constructServiceUrl(request, response);
                logger.debug("Attempting CAS ticket validation with service={} and ticket={}", service, ticket);
                request.login(service, ticket);
                if (request.getUserPrincipal() instanceof AssertionPrincipal) {
                    final AssertionPrincipal principal = (AssertionPrincipal) request.getUserPrincipal();
                    logger.debug("Installing CAS assertion into session.");
                    request.getSession().setAttribute(CONST_CAS_ASSERTION, principal.getAssertion());
                } else {
View Full Code Here

    public String login() {
        loggedIn = false;
        final FacesContext context = FacesContext.getCurrentInstance();
        try {
            HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
            request.login(userName, password);
            if (request.isUserInRole(Role.GuiUser.getName())) {
                loggedIn = true;
                return "sourceManager";
            }
            context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Недостаточно прав", null));
View Full Code Here

        if(username == null) {
            chain.doFilter(request, response);
            return;
        }
        try {
            req.login(username, password);
            chain.doFilter(request, response);
        } catch (ServletException e) {
            ((HttpServletResponse)response).setStatus(401);
        }
    }
View Full Code Here

         try
         {
            //only perform a login if the user is not already authenticated
            if (request.getRemoteUser() == null)
            {
               request.login(username, password);
            }
         }
         catch (ServletException e)
         {
            // FIXME
View Full Code Here

         try
         {
            //only perform a login if the user is not already authenticated
            if (request.getRemoteUser() == null)
            {
               request.login(username, password);
            }
         }
         catch (ServletException e)
         {
            // FIXME
View Full Code Here

    String result = null;
    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
    try
    {
      request.login(userId, new String(password));
      result = "/private/HomePage.xhtml?faces-redirect=true";
    }
    catch (ServletException ex)
    {
      logger.error("Failed to authenticate user.", ex);
View Full Code Here

            }

            if ( userNameCredential instanceof UsernamePasswordCredential ) {

                try {
                    request.login( userNameCredential.getUserName(), ( (UsernamePasswordCredential) userNameCredential ).getPassword().toString() );
                    if ( subject == null ) {
                        return true;
                    }
                } catch ( final ServletException ex ) {
                    return false;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.