本文整理了Java中org.opensaml.saml2.core.Assertion.setSignature()
方法的一些代码示例,展示了Assertion.setSignature()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertion.setSignature()
方法的具体详情如下:
包路径:org.opensaml.saml2.core.Assertion
类名称:Assertion
方法名:setSignature
暂无
代码示例来源:origin: cloudfoundry/uaa
private void signAssertion(Assertion assertion, Credential credential)
throws SecurityException, MarshallingException, SignatureException {
SignatureBuilder signatureBuilder = (SignatureBuilder) builderFactory
.getBuilder(Signature.DEFAULT_ELEMENT_NAME);
Signature signature = signatureBuilder.buildObject();
signature.setSigningCredential(credential);
SecurityHelper.prepareSignatureParams(signature, credential, null, null);
assertion.setSignature(signature);
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(assertion);
marshaller.marshall(assertion);
Signer.signObject(signature);
}
代码示例来源:origin: cloudfoundry/uaa
signature.setSigningCredential(defaultCredential);
SecurityHelper.prepareSignatureParams(signature, defaultCredential, null, null);
assertion.setSignature(signature);
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(assertion);
marshaller.marshall(assertion);
代码示例来源:origin: org.opensaml/opensaml
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
Assertion assertion = (Assertion) parentObject;
if (childObject instanceof Issuer) {
assertion.setIssuer((Issuer) childObject);
} else if (childObject instanceof Signature) {
assertion.setSignature((Signature) childObject);
} else if (childObject instanceof Subject) {
assertion.setSubject((Subject) childObject);
} else if (childObject instanceof Conditions) {
assertion.setConditions((Conditions) childObject);
} else if (childObject instanceof Advice) {
assertion.setAdvice((Advice) childObject);
} else if (childObject instanceof Statement) {
assertion.getStatements().add((Statement) childObject);
} else {
super.processChildElement(parentObject, childObject);
}
}
代码示例来源:origin: se.skltp.adapterservices.se.apotekensservice/TicketMachine
@Override
public Assertion build() {
AssertionBuilder assertionBuilder = (AssertionBuilder) xmlObjectBuilderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
Assertion assertion = assertionBuilder.buildObject();
assertion.setID(id);
assertion.setIssueInstant(issueInstant);
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssuer(issuer);
assertion.setSubject(subject);
assertion.setConditions(conditions);
if(signature !=null){
assertion.setSignature(signature);
}
if(authnStatements.size() > 0){
for (AuthnStatement authnStatement : authnStatements) {
assertion.getAuthnStatements().add(authnStatement);
}
}
if(attributeStatements.size() > 0){
for (AttributeStatement attributeStatement : attributeStatements) {
assertion.getAttributeStatements().add(attributeStatement);
}
}
return assertion;
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.provider
@Override
public void setSignature(String signatureAlgorithm, X509Credential cred) throws IdentityProviderException {
Signature signature = (Signature) buildXMLObject(Signature.DEFAULT_ELEMENT_NAME);
signature.setSigningCredential(cred);
signature.setSignatureAlgorithm(signatureAlgorithm);
signature.setCanonicalizationAlgorithm(Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
try {
KeyInfo keyInfo = (KeyInfo) buildXMLObject(KeyInfo.DEFAULT_ELEMENT_NAME);
X509Data data = (X509Data) buildXMLObject(X509Data.DEFAULT_ELEMENT_NAME);
X509Certificate cert = (X509Certificate) buildXMLObject(X509Certificate.DEFAULT_ELEMENT_NAME);
String value = Base64.encode(cred.getEntityCertificate().getEncoded());
cert.setValue(value);
data.getX509Certificates().add(cert);
keyInfo.getX509Datas().add(data);
signature.setKeyInfo(keyInfo);
} catch (CertificateEncodingException e) {
log.error("Failed to get encoded certificate", e);
throw new IdentityProviderException("Error while getting encoded certificate");
}
assertion.setSignature(signature);
signatureList.add(signature);
}
代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.openid/org.wso2.carbon.identity.provider
@Override
public void setSignature(String signatureAlgorithm, X509Credential cred) throws IdentityProviderException {
Signature signature = (Signature) buildXMLObject(Signature.DEFAULT_ELEMENT_NAME);
signature.setSigningCredential(cred);
signature.setSignatureAlgorithm(signatureAlgorithm);
signature.setCanonicalizationAlgorithm(Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
try {
KeyInfo keyInfo = (KeyInfo) buildXMLObject(KeyInfo.DEFAULT_ELEMENT_NAME);
X509Data data = (X509Data) buildXMLObject(X509Data.DEFAULT_ELEMENT_NAME);
X509Certificate cert = (X509Certificate) buildXMLObject(X509Certificate.DEFAULT_ELEMENT_NAME);
String value = Base64.encode(cred.getEntityCertificate().getEncoded());
cert.setValue(value);
data.getX509Certificates().add(cert);
keyInfo.getX509Datas().add(data);
signature.setKeyInfo(keyInfo);
} catch (CertificateEncodingException e) {
log.error("Failed to get encoded certificate", e);
throw new IdentityProviderException("Error while getting encoded certificate");
}
assertion.setSignature(signature);
signatureList.add(signature);
}
代码示例来源:origin: org.apache.rampart/rampart-trust
assertion.setSignature(signature);
内容来源于网络,如有侵权,请联系作者删除!