Examples of LoginDetail


Examples of com.springapp.mvc.web.model.LoginDetail

        // AnnotationUtils is a Spring Framework utility class.
        //if (AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class) != null)
        //    throw e;

        // Otherwise setup and send the user to a default error-view.
        LoginDetail loginDetail = new LoginDetail();
        loginDetail.setError(e.toString());//addObject("exception", e);
        loginDetail.setStatus(false);
        //loginDetail.setViewName(DEFAULT_ERROR_VIEW);
        return loginDetail;
    }
View Full Code Here

Examples of com.springapp.mvc.web.model.LoginDetail

            @RequestParam("user") String username,
            @RequestParam("password") String password,
            HttpServletRequest request, HttpServletResponse response) {
        Authentication token =
                new UsernamePasswordAuthenticationToken(username, password);
        LoginDetail loginDetail = new LoginDetail();
        try {
            Authentication authentication = authenticationManager.authenticate(token);
            SecurityContextHolder.getContext().setAuthentication(authentication);
            //return new LoginDetail().success().principal(authentication.getName());
            //return loginDetail;
            loginDetail.setUsername(authentication.getName());
            //loginDetail.setRole(authentication.getAuthorities());
            loginDetail.setStatus(true);
        } catch (BadCredentialsException ex) {
            //return "{\"status\": false, \"error\": \"Bad Credentials\"}";
            loginDetail.setError(ex.toString());
        }

        return loginDetail;
    }
View Full Code Here

Examples of com.springapp.mvc.web.model.LoginDetail

    @ExceptionHandler(value = {AuthenticationException.class, AccessDeniedException.class})
    @RequestMapping(value = "/denied")
    @ResponseBody
    public LoginDetail denied(HttpServletRequest request, HttpServletResponse response) {

        LoginDetail loginDetail = new LoginDetail();
        loginDetail.setError("Access denied");
        loginDetail.setStatus(false);
        return loginDetail;
    }
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.