本文整理了Java中org.opensaml.saml2.core.Assertion.setID()
方法的一些代码示例,展示了Assertion.setID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertion.setID()
方法的具体详情如下:
包路径:org.opensaml.saml2.core.Assertion
类名称:Assertion
方法名:setID
[英]Sets the ID of this assertion.
[中]设置此断言的ID。
代码示例来源:origin: cloudfoundry/uaa
private Assertion buildAssertion(Authentication authentication, AuthnRequest authnRequest,
IdpWebSSOProfileOptions options, String audienceURI, String issuerEntityId) throws SAMLException{
@SuppressWarnings("unchecked")
SAMLObjectBuilder<Assertion> assertionBuilder = (SAMLObjectBuilder<Assertion>) builderFactory
.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
Assertion assertion = assertionBuilder.buildObject();
assertion.setID(generateID());
assertion.setIssueInstant(new DateTime());
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssuer(getIssuer(issuerEntityId));
buildAssertionAuthnStatement(assertion);
buildAssertionConditions(assertion, options.getAssertionTimeToLiveSeconds(), audienceURI);
buildAssertionSubject(assertion, authnRequest, options.getAssertionTimeToLiveSeconds(),
(UaaPrincipal) authentication.getPrincipal());
buildAttributeStatement(assertion, authentication, audienceURI);
return assertion;
}
代码示例来源:origin: org.opensaml/opensaml
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
Assertion assertion = (Assertion) samlObject;
if (attribute.getLocalName().equals(Assertion.VERSION_ATTRIB_NAME)) {
assertion.setVersion(SAMLVersion.valueOf(attribute.getValue()));
} else if (attribute.getLocalName().equals(Assertion.ISSUE_INSTANT_ATTRIB_NAME)
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
assertion.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (attribute.getLocalName().equals(Assertion.ID_ATTRIB_NAME)) {
assertion.setID(attribute.getValue());
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
} else {
super.processAttribute(samlObject, attribute);
}
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
/**
* Method getId returns the id of this AssertionWrapper model.
*
* @return the id (type String) of this AssertionWrapper model.
*/
public String getId() {
String id = null;
if (saml2 != null) {
id = saml2.getID();
} else {
log.error("AssertionWrapper: unable to return ID - no saml assertion model");
}
if (id == null || id.length() == 0) {
log.error("AssertionWrapper: ID was null, seeting a new ID value");
id = UUIDGenerator.getUUID();
if (saml2 != null) {
saml2.setID(id);
}
}
return id;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
/**
* Method getId returns the id of this AssertionWrapper object.
*
* @return the id (type String) of this AssertionWrapper object.
*/
public String getId() {
String id = null;
if (saml2 != null) {
id = saml2.getID();
} else if (saml1 != null) {
id = saml1.getID();
} else {
LOG.error("AssertionWrapper: unable to return ID - no saml assertion object");
}
if (id == null || id.length() == 0) {
LOG.error("AssertionWrapper: ID was null, seeting a new ID value");
id = "_" + UUIDGenerator.getUUID();
if (saml2 != null) {
saml2.setID(id);
} else if (saml1 != null) {
saml1.setID(id);
}
}
return id;
}
代码示例来源:origin: org.apache.ws.security/wss4j
/**
* Method getId returns the id of this AssertionWrapper object.
*
* @return the id (type String) of this AssertionWrapper object.
*/
public String getId() {
String id = null;
if (saml2 != null) {
id = saml2.getID();
} else if (saml1 != null) {
id = saml1.getID();
} else {
LOG.error("AssertionWrapper: unable to return ID - no saml assertion object");
}
if (id == null || id.length() == 0) {
LOG.error("AssertionWrapper: ID was null, seeting a new ID value");
id = "_" + UUIDGenerator.getUUID();
if (saml2 != null) {
saml2.setID(id);
} else if (saml1 != null) {
saml1.setID(id);
}
}
return id;
}
代码示例来源:origin: org.apache.rampart/rampart-trust
public static Assertion createAssertion() throws TrustException {
try {
Assertion assertion = (Assertion)CommonUtil.buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
assertion.setVersion(SAMLVersion.VERSION_20);
// Set an UUID as the ID of an assertion
assertion.setID(UUIDGenerator.getUUID());
return assertion;
} catch (TrustException e) {
throw new TrustException("Unable to create an Assertion object", e);
}
}
代码示例来源:origin: org.apache.ws.security/wss4j
/**
* Create a SAML 2 assertion
*
* @return a SAML 2 assertion
*/
@SuppressWarnings("unchecked")
public static Assertion createAssertion() {
if (assertionBuilder == null) {
assertionBuilder = (SAMLObjectBuilder<Assertion>)
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
if (assertionBuilder == null) {
throw new IllegalStateException(
"OpenSaml engine not initialized. Please make sure to initialize the OpenSaml engine "
+ "prior using it"
);
}
}
Assertion assertion =
assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME);
assertion.setID("_" + UUIDGenerator.getUUID());
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssueInstant(new DateTime());
return assertion;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
/**
* Create a SAML 2 assertion
*
* @return a SAML 2 assertion
*/
@SuppressWarnings("unchecked")
public static Assertion createAssertion() {
if (assertionBuilder == null) {
assertionBuilder = (SAMLObjectBuilder<Assertion>)
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
if (assertionBuilder == null) {
throw new IllegalStateException(
"OpenSaml engine not initialized. Please make sure to initialize the OpenSaml engine "
+ "prior using it"
);
}
}
Assertion assertion =
assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME);
assertion.setID("_" + UUIDGenerator.getUUID());
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssueInstant(new DateTime());
return assertion;
}
代码示例来源:origin: usnistgov/iheos-toolkit2
/**
* Create a SAML 2 assertion
*
* @return a SAML 2 assertion
*/
@SuppressWarnings("unchecked")
public static Assertion createAssertion() {
if (assertionBuilder == null) {
assertionBuilder = (SAMLObjectBuilder<Assertion>)
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
if (assertionBuilder == null) {
throw new IllegalStateException(
"OpenSaml engine not initialized. Please make sure to initialize the OpenSaml engine "
+ "prior using it"
);
}
}
Assertion assertion =
assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME);
assertionId = UUIDGenerator.getUUID();
assertion.setID(assertionId);
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssueInstant(new DateTime());
return assertion;
}
代码示例来源: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: OpenConext/Mujina
public static Assertion buildAssertion(SAMLPrincipal principal, Status status, String entityId) {
Assertion assertion = buildSAMLObject(Assertion.class, Assertion.DEFAULT_ELEMENT_NAME);
if (status.getStatusCode().getValue().equals(StatusCode.SUCCESS_URI)) {
Subject subject = buildSubject(principal.getNameID(), principal.getNameIDType(), principal.getAssertionConsumerServiceURL(), principal.getRequestID());
assertion.setSubject(subject);
}
Issuer issuer = buildIssuer(entityId);
Audience audience = buildSAMLObject(Audience.class, Audience.DEFAULT_ELEMENT_NAME);
audience.setAudienceURI(principal.getServiceProviderEntityID());
AudienceRestriction audienceRestriction = buildSAMLObject(AudienceRestriction.class, AudienceRestriction.DEFAULT_ELEMENT_NAME);
audienceRestriction.getAudiences().add(audience);
Conditions conditions = buildSAMLObject(Conditions.class, Conditions.DEFAULT_ELEMENT_NAME);
conditions.getAudienceRestrictions().add(audienceRestriction);
assertion.setConditions(conditions);
AuthnStatement authnStatement = buildAuthnStatement(new DateTime(), entityId);
assertion.setIssuer(issuer);
assertion.getAuthnStatements().add(authnStatement);
assertion.getAttributeStatements().add(buildAttributeStatement(principal.getAttributes()));
assertion.setID(randomSAMLId());
assertion.setIssueInstant(new DateTime());
return assertion;
}
代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.openid/org.wso2.carbon.identity.provider
assertion.setID(assertionId);
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.provider
assertion.setID(assertionId);
代码示例来源:origin: be.e_contract.sts/sts-client-cxf
assertion.setVersion(SAMLVersion.VERSION_20);
String assertionId = "assertion-" + UUID.randomUUID().toString();
assertion.setID(assertionId);
DateTime issueInstant = new DateTime();
assertion.setIssueInstant(issueInstant);
代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2
assertion.setVersion(SAMLVersion.VERSION_20);
String assertionId = "assertion-" + UUID.randomUUID().toString();
assertion.setID(assertionId);
assertion.setIssueInstant(issueInstant);
DateTime currentTime = new DateTime();
Assertion assertion = new AssertionBuilder().buildObject();
assertion.setID(SAML2AuthUtils.createID());
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setIssuer(getIssuer());
DateTime currentTime = new DateTime();
Assertion samlAssertion = new AssertionBuilder().buildObject();
samlAssertion.setID(SAMLSSOUtil.createID());
samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.tools.saml.validator
DateTime currentTime = new DateTime();
Assertion samlAssertion = new AssertionBuilder().buildObject();
samlAssertion.setID(SAMLSSOUtil.createID());
samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml
DateTime currentTime = new DateTime();
Assertion samlAssertion = new AssertionBuilder().buildObject();
samlAssertion.setID(SAMLSSOUtil.createID());
samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml.cloud/org.wso2.carbon.identity.sso.saml.cloud
Assertion samlAssertion = new AssertionBuilder().buildObject();
SAMLSSOServiceProviderDO samlssoServiceProviderDO = context.getSamlssoServiceProviderDO();
samlAssertion.setID(SAMLSSOUtil.createID());
samlAssertion.setVersion(SAMLVersion.VERSION_20);
samlAssertion.setIssuer(SAMLSSOUtil.getIssuer());
内容来源于网络,如有侵权,请联系作者删除!