Package org.beangle.security.core

Examples of org.beangle.security.core.Authentication


    if (exception instanceof AuthenticationException) {
      logger.debug("Authentication exception occurred", exception);
      sendStartAuthentication(request, response, chain, (AuthenticationException) exception);
    } else if (exception instanceof AccessDeniedException) {
      AccessDeniedException ae = (AccessDeniedException) exception;
      Authentication auth = SecurityContextHolder.getContext().getAuthentication();
      if (AuthenticationUtils.isValid(auth)) {
        logger.debug("{} access {} is denied", auth.getName(), ae.getResource());
        accessDeniedHandler.handle(request, response, (AccessDeniedException) exception);
      } else {
        logger.debug("anonymous access {} is denied", ae.getResource());
        sendStartAuthentication(request, response, chain,
            new AuthenticationException(ae.getMessage()));
View Full Code Here


    while (iter.hasNext()) {
      AuthenticationProvider provider = iter.next();
      if (!provider.supports(toTest)) {
        continue;
      }
      Authentication result;
      try {
        result = provider.authenticate(auth);
        if (result != null) {
          copyDetails(auth, result);
          // sessionController.checkAuthenticationAllowed(result);
View Full Code Here

  @Override
  protected void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    if (requiresLogout(request, response)) {
      Authentication auth = SecurityContextHolder.getContext().getAuthentication();
      logger.debug("Logging out user '{}' and redirecting to logout page", auth);
      handlerStack.logout(request, response, auth);
      String targetUrl = determineTargetUrl(request, response);
      RedirectUtils.sendRedirect(request, response, targetUrl);
      return;
View Full Code Here

  private boolean clearExtraInfo = false;
  protected Logger logger = LoggerFactory.getLogger(AbstractAuthenticationManager.class);

  public final Authentication authenticate(Authentication authRequest) throws AuthenticationException {
    try {
      Authentication auth = doAuthentication(authRequest);
      logger.debug("Successfully Authenticated: {}", auth);
      return auth;
    } catch (AuthenticationException e) {
      e.setAuthentication(authRequest);
      if (clearExtraInfo) {
View Full Code Here

  protected String determineExpiredUrl(HttpServletRequest request, SessionStatus info) {
    return expiredUrl;
  }

  private void doLogout(HttpServletRequest request, HttpServletResponse response) {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    handlerStack.logout(request, response, auth);
  }
View Full Code Here

   * @param request
   * @param response
   * @return
   */
  protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth == null) { return true; }
    return (null != authenticationAliveChecker) ? !authenticationAliveChecker.check(auth, request)
        : false;
  }
View Full Code Here

  /**
   * Do the actual authentication for a pre-authenticated user.
   */
  private void doAuthenticate(HttpServletRequest request, HttpServletResponse response) {
    Authentication authResult = null;
    PreauthAuthentication auth = getPreauthAuthentication(request, response);
    if (auth == null) {
      logger.debug("No pre-authenticated principal found in request");
      return;
    } else {
View Full Code Here

public class LogoutAction extends BaseAction {

  private LogoutHandlerStack handlerStack;

  public String index() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    String result = "success";
    if (AuthenticationUtils.isValid(auth)) {
      if (null != handlerStack) handlerStack.logout(getRequest(), getResponse(), auth);
      ((SessionMap<?, ?>) ActionContext.getContext().getSession()).invalidate();
      String targetUrl = determineTargetUrl(getRequest());
View Full Code Here

    if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { return "failure"; }
    username = username.trim();
    UsernamePasswordAuthentication auth= new UsernamePasswordAuthentication(username,
        password);
    auth.setDetails(authenticationDetailsSource.buildDetails(request));
    Authentication authRequest =auth;
    try {
      authRequest= authenticationManager.authenticate(authRequest);
      sessionStrategy.onAuthentication(authRequest, request, null);
      SecurityContextHolder.getContext().setAuthentication(authRequest);
    } catch (AuthenticationException e) {
View Full Code Here

  private List<LogoutHandler> handlers = CollectUtils.newArrayList();
  private HttpServletRequest request;
  private HttpServletResponse response;

  public String index() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    String result = "success";
    if (AuthenticationUtils.isValid(auth)) {
      for (LogoutHandler handler : handlers) {
        handler.logout(request, response, auth);
      }
View Full Code Here

TOP

Related Classes of org.beangle.security.core.Authentication

Copyright © 2018 www.massapicom. 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.