protected Extensions getSAMLExtensions(HttpServletRequest request) { try { String samlRequest = request.getParameter(SSOConstants.HTTP_POST_PARAM_SAML2_AUTH_REQ); if (samlRequest == null) { samlRequest = (String) request.getAttribute(SSOConstants.HTTP_POST_PARAM_SAML2_AUTH_REQ); } if (samlRequest != null) { XMLObject xmlObject; if (SSOConstants.HTTP_POST.equals(request.getMethod())) { xmlObject = unmarshall(SSOUtils.decodeForPost(samlRequest)); } else { xmlObject = unmarshall(SSOUtils.decode(samlRequest)); } if (xmlObject instanceof AuthnRequest) { AuthnRequest authnRequest = (AuthnRequest) xmlObject; Extensions oldExtensions = authnRequest.getExtensions(); if (oldExtensions != null) { ExtensionsBuilder extBuilder = new ExtensionsBuilder(); Extensions extensions = extBuilder.buildObject( SAMLConstants.SAML20P_NS, Extensions.LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); extensions.setDOM(oldExtensions.getDOM()); return extensions; } } } } catch (Exception e) { // TODO IDENTITY-2421 // ignore log.debug("Error while loading SAML Extensions", e); } return null; }
protected Extensions getSAMLExtensions(AuthnRequest inboundAuthnRequest) { Extensions extensions = null; Extensions oldExtensions = inboundAuthnRequest.getExtensions(); if (oldExtensions != null) { ExtensionsBuilder extBuilder = new ExtensionsBuilder(); extensions = extBuilder.buildObject( SAMLConstants.SAML20P_NS, Extensions.LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); extensions.setDOM(oldExtensions.getDOM()); } return extensions; }