Search in sources :

Example 1 with RelyingPartyLogoutCallback

use of it.spid.cie.oidc.callback.RelyingPartyLogoutCallback in project spid-cie-oidc-java by italia.

the class SpidController method logout.

@GetMapping("/logout")
public RedirectView logout(@RequestParam Map<String, String> params, final HttpServletRequest request, HttpServletResponse response) throws Exception {
    String userKey = GetterUtil.getString(request.getSession().getAttribute("USER"));
    String redirectURL = relyingPartyWrapper.performLogout(userKey, new RelyingPartyLogoutCallback() {

        @Override
        public void logout(String userKey, AuthnRequest authnRequest, AuthnToken authnToken) {
            request.getSession().removeAttribute("USER");
            request.getSession().removeAttribute("USER_INFO");
        }
    });
    if (!Validator.isNullOrEmpty(redirectURL)) {
        return new RedirectView(redirectURL);
    }
    return new RedirectView("landing");
}
Also used : RelyingPartyLogoutCallback(it.spid.cie.oidc.callback.RelyingPartyLogoutCallback) AuthnRequest(it.spid.cie.oidc.model.AuthnRequest) AuthnToken(it.spid.cie.oidc.model.AuthnToken) RedirectView(org.springframework.web.servlet.view.RedirectView) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

RelyingPartyLogoutCallback (it.spid.cie.oidc.callback.RelyingPartyLogoutCallback)1 AuthnRequest (it.spid.cie.oidc.model.AuthnRequest)1 AuthnToken (it.spid.cie.oidc.model.AuthnToken)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 RedirectView (org.springframework.web.servlet.view.RedirectView)1