Package org.opensaml.xml.validation

Examples of org.opensaml.xml.validation.ValidationException


     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateChildrenPresence(X509Data xmlObject) throws ValidationException {
        if (xmlObject.getXMLObjects().isEmpty()) {
            throw new ValidationException("No children were present in the X509Data object");
        }
    }
View Full Code Here


        // or are from another namespace.
        for (XMLObject child : xmlObject.getXMLObjects()) {
            QName childName = child.getElementQName();
            if (! getValidDSChildNames().contains(childName)
                    && XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
                throw new ValidationException("X509Data contains an illegal child extension element: " + childName);
            }
        }
    }
View Full Code Here

        XMLSignature xmlSig = buildSignature(signature);

        Key validationKey = SecurityHelper.extractVerificationKey(validationCredential);
        if (validationKey == null) {
            log.debug("Supplied credential contained no key suitable for signature validation");
            throw new ValidationException("No key available to validate signature");
        }
       
        log.debug("Validating signature with signature algorithm URI: {}", signature.getSignatureAlgorithm());
        log.debug("Validation credential key algorithm '{}', key instance class '{}'",
                validationKey.getAlgorithm(), validationKey.getClass().getName());

        try {
            if (xmlSig.checkSignatureValue(validationKey)) {
                log.debug("Signature validated with key from supplied credential");
                return;
            }
        } catch (XMLSignatureException e) {
            throw new ValidationException("Unable to evaluate key against signature", e);
        }

        log.debug("Signature did not validate against the credential's key");

        throw new ValidationException("Signature did not validate against the credential's key");
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateChildrenPresence(DSAKeyValue xmlObject) throws ValidationException {
        if (xmlObject.getY() == null) {
            throw new ValidationException("DSAKeyValue did not contain a required Y value");
        }
       
        if (xmlObject.getP() != null && xmlObject.getQ() == null) {
            throw new ValidationException("RSAKeyValue did contained a P value without a Q value");
        } else if (xmlObject.getQ() != null && xmlObject.getP() == null) {
            throw new ValidationException("RSAKeyValue did contained a Q value without a P value");
        }
       
        if (xmlObject.getPgenCounter() != null && xmlObject.getSeed() == null) {
            throw new ValidationException("RSAKeyValue did contained a PgenCounter value without a Seed value");
        } else if (xmlObject.getSeed() != null && xmlObject.getPgenCounter() == null) {
            throw new ValidationException("RSAKeyValue did contained a Seed value without a PgenCounter value");
        }
       
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateChildrenPresence(ECKeyValue xmlObject) throws ValidationException {
        if (xmlObject.getPublicKey() == null) {
            throw new ValidationException("ECKeyValue did not contain a required PublicKey value");
        } else if (xmlObject.getNamedCurve() == null && xmlObject.getECParameters() == null) {
            throw new ValidationException("ECKeyValue did not contain a required NamedCurve or ECParameters value");
        }
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateContent(X509Digest xmlObject) throws ValidationException {
        if (xmlObject.getValue() == null) {
            throw new ValidationException("X509Digest did not contain a value");
        } else if (DatatypeHelper.isEmpty(xmlObject.getAlgorithm())) {
            throw new ValidationException("X509Digest did not contain Algorithm attribute");
        }
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateURI(NamedCurve xmlObject) throws ValidationException {
        if (DatatypeHelper.isEmpty(xmlObject.getURI())) {
            throw new ValidationException("NamedCurve URI was empty");
        }
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateTransforms(Transforms xmlObject) throws ValidationException {
        if (xmlObject.getTransforms().isEmpty()) {
            throw new ValidationException("No Transform children were present in the Transforms object");
        }
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateChildrenPresence(EncryptedType xmlObject) throws ValidationException {
        if (xmlObject.getCipherData() == null) {
            throw new ValidationException("EncryptedType did not contain a CipherData child");
        }
    }
View Full Code Here

     * @param xmlObject the object to validate
     * @throws ValidationException  thrown if the object is invalid
     */
    protected void validateURI(ReferenceType xmlObject) throws ValidationException {
        if (DatatypeHelper.isEmpty(xmlObject.getURI())) {
            throw new ValidationException("ReferenceType URI was empty");
        }
    }
View Full Code Here

TOP

Related Classes of org.opensaml.xml.validation.ValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.