Example usage for org.springframework.security.core.context SecurityContextHolder clearContext

List of usage examples for org.springframework.security.core.context SecurityContextHolder clearContext

Introduction

In this page you can find the example usage for org.springframework.security.core.context SecurityContextHolder clearContext.

Prototype

public static void clearContext() 

Source Link

Document

Explicitly clears the context value from the current thread.

Usage

From source file:co.com.soinsoftware.altablero.utils.AuthenticationUtils.java

public static void setAnonymusAuthentication() {
    SecurityContextHolder.getContext().setAuthentication(null);
    SecurityContextHolder.clearContext();
}

From source file:com.qpark.eip.core.spring.security.EipUserDetailsService.java

/**    */
public static void clearSecurityContextHolderAuthentication() {
    SecurityContextHolder.clearContext();
}

From source file:com.mycompany.login.mb.LoginBean.java

public String logout() {
    SecurityContextHolder.clearContext();
    return "logout";
}

From source file:org.springside.modules.security.springsecurity.cxf.SpringSecurityOutInterceptor.java

public void handleMessage(Message message) throws Fault {
    SecurityContextHolder.clearContext();
}

From source file:com.erudika.para.security.SecurityUtils.java

/**
 * Clears the session. Deletes cookies and clears the security context.
 * @param req HTTP request//from  w w  w  .  ja va2s. c om
 */
public static void clearSession(HttpServletRequest req) {
    SecurityContextHolder.clearContext();
    if (req != null) {
        HttpSession session = req.getSession(false);
        if (session != null) {
            session.invalidate();
        }
    }
}

From source file:com.mycompany.CRMFly.Security.AccountController.java

public String submitChangePasswordPage() {
    Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    String username = principal.toString();

    if (principal instanceof UserDetails) {
        username = ((UserDetails) principal).getUsername();
    }/*from www  .ja  v  a2 s .c o m*/

    changePasswordDao.changePassword(username, newPassword);
    SecurityContextHolder.clearContext();

    FacesContext.getCurrentInstance().addMessage(null,
            new FacesMessage(FacesMessage.SEVERITY_INFO, " ? .", null));

    return null;
}

From source file:hu.unideb.studentSupportInterface.backing.UserInfo.java

public String logout() {
    SecurityContextHolder.clearContext();
    return "/login?faces-redirect=true";
}

From source file:org.cloudfoundry.identity.uaa.security.DefaultSecurityContextAccessorTests.java

@After
public void clearContext() throws Exception {
    SecurityContextHolder.clearContext();
}

From source file:org.apache.cxf.fediz.service.idp.beans.LogoutAction.java

public void submit(RequestContext requestContext) {
    SecurityContextHolder.clearContext();
    LOG.info("Security context has been cleared.");
    HttpSession session = WebUtils.getHttpSession(requestContext);
    session.invalidate();//from   ww  w . j  a v  a 2 s.c o m
    LOG.info("Session " + session.getId() + " has been invalidated.");
}

From source file:test.IndexController.java

@RequestMapping(method = RequestMethod.GET, path = "/logout")
public String sair(HttpServletRequest arg0) {
    arg0.getSession(true).invalidate();/*  w w w. j av  a  2 s.  co  m*/
    SecurityContextHolder.clearContext();
    System.out.println("saindo");
    return "sair";
}