java - OpenSaml encryptedID Validation Failed -
my need encrypt nameid , send in authnrequest. i'm facing problem opensaml (v 2.6.1) validator subjectshemavalidator. request validation fails error "id or subjectconfirmation required" because there no baseid, baseid, nor subjectconfirmations.
here authent request :
<saml2p:authnrequest assertionconsumerserviceurl="https:..." forceauthn="false" id="4ed1e8875b99" issueinstant="2016-01-27t15:39:26.195z" protocolbinding="post" version="2.0" xmlns:saml2p="urn:oasis:names:tc:saml:2.0:protocol"><saml2:issuer xmlns:saml2="urn:oasis:names:tc:saml:2.0:assertion">application</saml2:issuer><saml2:subject xmlns:saml2="urn:oasis:names:tc:saml:2.0:assertion"><saml2:encryptedid><xenc:encrypteddata id="_b8b7761b84db0c4c5254b4f4c3ef9d1d" type="http://www.w3.org/2001/04/xmlenc#element" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"/><ds:keyinfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><xenc:encryptedkey id="_922bd10322d761ca1a5450213da896ea" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><ds:digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/></xenc:encryptionmethod><xenc:cipherdata xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:ciphervalue>abcd</xenc:ciphervalue></xenc:cipherdata></xenc:encryptedkey></ds:keyinfo><xenc:cipherdata xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:ciphervalue>efgh</xenc:ciphervalue></xenc:cipherdata></xenc:encrypteddata></saml2:encryptedid><saml2:subjectconfirmation method="urn:oasis:names:tc:saml:2.0:cm:bearer"/></saml2:subject></saml2p:authnrequest>
is bug on opensaml validator because not check encryptedid ? or missed ??
instead of ecrypton of nameid can directly put this
authnrequest request = buildsamlobject(authnrequest.class); nameidpolicy nameidpolicy = buildsamlobject(nameidpolicy.class); nameidpolicy.setallowcreate(true); nameidpolicy.setformat(nameidtype.email); request.setnameidpolicy(nameidpolicy); public static <t> t buildsamlobject(final class<t> clazz) { t object = null; try { xmlobjectbuilderfactory builderfactory = configuration .getbuilderfactory(); qname defaultelementname = (qname) clazz.getdeclaredfield( "default_element_name").get(null); object = (t) builderfactory.getbuilder(defaultelementname) .buildobject(defaultelementname); } catch (illegalaccessexception e) { throw new illegalargumentexception("could not create saml object"); } catch (nosuchfieldexception e) { throw new illegalargumentexception("could not create saml object"); } return object; }
Comments
Post a Comment