changeSession login

This commit is contained in:
Crystal.Sea
2020-11-20 07:53:31 +08:00
parent 6e83568945
commit a99ecf16f5
11 changed files with 61 additions and 37 deletions

View File

@@ -59,7 +59,8 @@ public class AssertionEndpoint {
@RequestMapping(value = "/authz/saml20/assertion")
public ModelAndView assertion(HttpServletRequest request,HttpServletResponse response) throws Exception {
logger.debug("saml20 assertion start.");
bindingAdapter = (BindingAdapter) request.getSession().getAttribute("samlv20Adapter");
bindingAdapter = (BindingAdapter) request.getSession().getAttribute(
WebConstants.AUTHORIZE_SIGN_ON_APP_SAMLV20_ADAPTER);
logger.debug("saml20 assertion get session samlv20Adapter "+bindingAdapter);
AppsSAML20Details saml20Details = bindingAdapter.getSaml20Details();
logger.debug("saml20Details "+saml20Details.getExtendAttr());

View File

@@ -21,7 +21,6 @@ import java.security.KeyStore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.maxkey.authz.saml.common.AuthnRequestInfo;
import org.maxkey.authz.saml20.binding.BindingAdapter;
import org.maxkey.authz.saml20.binding.ExtractBindingAdapter;
@@ -29,6 +28,7 @@ import org.maxkey.crypto.keystore.KeyStoreLoader;
import org.maxkey.crypto.keystore.KeyStoreUtil;
import org.maxkey.domain.apps.AppsSAML20Details;
import org.maxkey.persistence.service.AppsSaml20DetailsService;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -88,7 +88,7 @@ public class IdpInitEndpoint {
@PathVariable("appid") String appId)throws Exception {
logger.debug("SAML IDP init , app id is "+appId);
AppsSAML20Details saml20Details = saml20DetailsService.getAppDetails(appId);
WebContext.setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP, saml20Details);
if (saml20Details == null) {
logger.error("samlId[" + appId + "] Error .");
throw new Exception();
@@ -114,7 +114,7 @@ public class IdpInitEndpoint {
bindingAdapter.setExtractBindingAdapter(extractRedirectBindingAdapter);
request.getSession().setAttribute("samlv20Adapter", bindingAdapter);
request.getSession().setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP_SAMLV20_ADAPTER, bindingAdapter);
logger.debug("idp init forwarding to assertion :","/authz/saml20/assertion");

View File

@@ -21,7 +21,6 @@ import java.security.KeyStore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.maxkey.authz.saml.common.AuthnRequestInfo;
import org.maxkey.authz.saml20.binding.BindingAdapter;
import org.maxkey.authz.saml20.binding.ExtractBindingAdapter;
@@ -29,6 +28,7 @@ import org.maxkey.authz.saml20.xml.SAML2ValidatorSuite;
import org.maxkey.crypto.keystore.KeyStoreUtil;
import org.maxkey.domain.apps.AppsSAML20Details;
import org.maxkey.persistence.service.AppsSaml20DetailsService;
import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext;
import org.opensaml.common.binding.SAMLMessageContext;
import org.opensaml.saml2.core.AuthnRequest;
@@ -101,14 +101,14 @@ public class SingleSignOnEndpoint {
extractSAMLMessage(extractBindingAdapter,request);
request.getSession().setAttribute("samlv20Adapter", bindingAdapter);
request.getSession().setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP_SAMLV20_ADAPTER, bindingAdapter);
return WebContext.forward("/authz/saml20/assertion");
}
public void extractSaml20Detail(ExtractBindingAdapter extractBindingAdapter,String samlId) throws Exception{
AppsSAML20Details saml20Details = saml20DetailsService.getAppDetails(samlId);
WebContext.setAttribute(WebConstants.AUTHORIZE_SIGN_ON_APP, saml20Details);
if (saml20Details == null) {
logger.error("Request SAML APPID [" + samlId + "] is not exist .");
throw new Exception();