/** * Sign an RequestType at the root * @param request * @param keypair Key Pair * @param digestMethod (Example: DigestMethod.SHA1) * @param signatureMethod (Example: SignatureMethod.DSA_SHA1) * @return * @throws ParserConfigurationException * @throws IOException * @throws SAXException * @throws XMLSignatureException * @throws MarshalException * @throws GeneralSecurityException */ public Document sign(RequestAbstractType request, KeyPair keypair) throws SAXException, IOException, ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException { SAML2Request saml2Request = new SAML2Request(); Document doc = saml2Request.convert(request); doc.normalize(); String referenceURI = "#" + request.getID(); return XMLSignatureUtil.sign(doc, keypair, digestMethod, signatureMethod, referenceURI); }
/** * Sign an RequestType at the root * * @param request * @param keypair Key Pair * @param digestMethod (Example: DigestMethod.SHA1) * @param signatureMethod (Example: SignatureMethod.DSA_SHA1) * @return * @throws ParserConfigurationException * @throws IOException * @throws SAXException * @throws XMLSignatureException * @throws MarshalException * @throws GeneralSecurityException */ public Document sign(RequestAbstractType request, KeyPair keypair) throws SAXException, IOException, ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException { SAML2Request saml2Request = new SAML2Request(); Document doc = saml2Request.convert(request); doc.normalize(); Node theSibling = getNextSiblingOfIssuer(doc); if (theSibling != null) { this.sibling = theSibling; } return sign(doc, request.getID(), keypair); }
/** * Sign an RequestType at the root * * @param request * @param keypair Key Pair * @param digestMethod (Example: DigestMethod.SHA1) * @param signatureMethod (Example: SignatureMethod.DSA_SHA1) * * @return * * @throws ParserConfigurationException * @throws IOException * @throws SAXException * @throws XMLSignatureException * @throws MarshalException * @throws GeneralSecurityException */ public Document sign(RequestAbstractType request, KeyPair keypair) throws SAXException, IOException, ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException { SAML2Request saml2Request = new SAML2Request(); Document doc = saml2Request.convert(request); doc.normalize(); Node theSibling = getNextSiblingOfIssuer(doc); if (theSibling != null) { this.sibling = theSibling; } return sign(doc, request.getID(), keypair); }
/** * Sign an RequestType at the root * * @param request * @param keypair Key Pair * @param digestMethod (Example: DigestMethod.SHA1) * @param signatureMethod (Example: SignatureMethod.DSA_SHA1) * * @return * * @throws ParserConfigurationException * @throws IOException * @throws SAXException * @throws XMLSignatureException * @throws MarshalException * @throws GeneralSecurityException */ public Document sign(RequestAbstractType request, KeyPair keypair) throws SAXException, IOException, ParserConfigurationException, GeneralSecurityException, MarshalException, XMLSignatureException { SAML2Request saml2Request = new SAML2Request(); Document doc = saml2Request.convert(request); doc.normalize(); Node theSibling = getNextSiblingOfIssuer(doc); if (theSibling != null) { this.sibling = theSibling; } return sign(doc, request.getID(), keypair); }
public StatusResponseType createStatusResponse(RequestAbstractType request, String statusCode, String statusMessage) { ObjectFactory objectFactory = new ObjectFactory(); org.picketlink.identity.federation.saml.v2.assertion.ObjectFactory assertionObjectFactory = new org.picketlink.identity.federation.saml.v2.assertion.ObjectFactory(); StatusResponseType response = objectFactory.createStatusResponseType(); response.setID(generateId()); response.setIssueInstant(generateIssueInstant()); NameIDType issuer = assertionObjectFactory.createNameIDType(); issuer.setValue(serviceProvider.getSamlConfiguration().getEntityId()); response.setIssuer(issuer); response.setVersion(JBossSAMLConstants.VERSION_2_0.get()); response.setInResponseTo(request.getID()); StatusCodeType statusCodeJaxb = objectFactory.createStatusCodeType(); statusCodeJaxb.setValue(statusCode); StatusType statusType = objectFactory.createStatusType(); statusType.setStatusCode(statusCodeJaxb); if (statusMessage != null) { statusType.setStatusMessage(statusMessage); } response.setStatus(statusType); return response; }