本文整理了Java中org.opensaml.saml.saml2.core.Assertion.getIssueInstant()
方法的一些代码示例,展示了Assertion.getIssueInstant()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertion.getIssueInstant()
方法的具体详情如下:
包路径:org.opensaml.saml.saml2.core.Assertion
类名称:Assertion
方法名:getIssueInstant
[英]Gets the issue instance of this assertion.
[中]获取此断言的问题实例。
代码示例来源:origin: net.shibboleth.idp/idp-saml-impl
public DateTime apply(final org.opensaml.saml.saml2.core.Assertion input) {
return input.getIssueInstant();
}
});
代码示例来源:origin: net.shibboleth.idp/idp-saml-impl
return Collections.singletonList(((org.opensaml.saml.saml2.core.Assertion) message).getIssueInstant());
} else if (message instanceof org.opensaml.saml.saml1.core.Assertion) {
return Collections.singletonList(((org.opensaml.saml.saml1.core.Assertion) message).getIssueInstant());
代码示例来源:origin: org.opensaml/opensaml-saml-impl
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
Assertion assertion = (Assertion) samlObject;
if (assertion.getVersion() != null) {
domElement.setAttributeNS(null, Assertion.VERSION_ATTRIB_NAME, assertion.getVersion().toString());
}
if (assertion.getIssueInstant() != null) {
String issueInstantStr = SAMLConfigurationSupport.getSAMLDateFormatter().print(assertion.getIssueInstant());
domElement.setAttributeNS(null, Assertion.ISSUE_INSTANT_ATTRIB_NAME, issueInstantStr);
}
if (assertion.getID() != null) {
domElement.setAttributeNS(null, Assertion.ID_ATTRIB_NAME, assertion.getID());
domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
}
}
}
代码示例来源:origin: org.opensaml/opensaml-saml-impl
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final Long lifetime = assertionLifetimeStrategy != null ?
assertionLifetimeStrategy.apply(profileRequestContext) : null;
if (lifetime == null) {
log.debug("{} No assertion lifetime supplied, using default", getLogPrefix());
}
if (response instanceof org.opensaml.saml.saml1.core.Response) {
for (final org.opensaml.saml.saml1.core.Assertion assertion :
((org.opensaml.saml.saml1.core.Response) response).getAssertions()) {
final DateTime expiration = new DateTime(assertion.getIssueInstant()).plus(
lifetime != null ? lifetime : defaultAssertionLifetime);
log.debug("{} Added NotOnOrAfter condition, indicating an expiration of {}, to Assertion {}",
new Object[] {getLogPrefix(), expiration, assertion.getID()});
SAML1ActionSupport.addConditionsToAssertion(this, assertion).setNotOnOrAfter(expiration);
}
} else if (response instanceof org.opensaml.saml.saml2.core.Response) {
for (final org.opensaml.saml.saml2.core.Assertion assertion :
((org.opensaml.saml.saml2.core.Response) response).getAssertions()) {
final DateTime expiration = new DateTime(assertion.getIssueInstant()).plus(
lifetime != null ? lifetime : defaultAssertionLifetime);
log.debug("{} Added NotOnOrAfter condition, indicating an expiration of {}, to Assertion {}",
new Object[] {getLogPrefix(), expiration, assertion.getID()});
SAML2ActionSupport.addConditionsToAssertion(this, assertion).setNotOnOrAfter(expiration);
}
}
}
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-common
&& getSaml2().getConditions() != null) {
validTill = getSaml2().getConditions().getNotOnOrAfter();
issueInstant = getSaml2().getIssueInstant();
} else if (getSamlVersion().equals(SAMLVersion.VERSION_11)
&& getSaml1().getConditions() != null) {
代码示例来源:origin: apache/cxf
protected boolean validateConditions(
SamlAssertionWrapper assertion, ReceivedToken validateTarget
) {
DateTime validFrom = null;
DateTime validTill = null;
DateTime issueInstant = null;
if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_20)) {
validFrom = assertion.getSaml2().getConditions().getNotBefore();
validTill = assertion.getSaml2().getConditions().getNotOnOrAfter();
issueInstant = assertion.getSaml2().getIssueInstant();
} else {
validFrom = assertion.getSaml1().getConditions().getNotBefore();
validTill = assertion.getSaml1().getConditions().getNotOnOrAfter();
issueInstant = assertion.getSaml1().getIssueInstant();
}
if (validFrom != null && validFrom.isAfterNow()) {
LOG.log(Level.WARNING, "SAML Token condition not met");
return false;
} else if (validTill != null && validTill.isBeforeNow()) {
LOG.log(Level.WARNING, "SAML Token condition not met");
validateTarget.setState(STATE.EXPIRED);
return false;
}
if (issueInstant != null && issueInstant.isAfterNow()) {
LOG.log(Level.WARNING, "SAML Token IssueInstant not met");
return false;
}
return true;
}
代码示例来源:origin: org.apache.cxf.services.sts/cxf-services-sts-core
protected boolean validateConditions(
SamlAssertionWrapper assertion, ReceivedToken validateTarget
) {
DateTime validFrom = null;
DateTime validTill = null;
DateTime issueInstant = null;
if (assertion.getSamlVersion().equals(SAMLVersion.VERSION_20)) {
validFrom = assertion.getSaml2().getConditions().getNotBefore();
validTill = assertion.getSaml2().getConditions().getNotOnOrAfter();
issueInstant = assertion.getSaml2().getIssueInstant();
} else {
validFrom = assertion.getSaml1().getConditions().getNotBefore();
validTill = assertion.getSaml1().getConditions().getNotOnOrAfter();
issueInstant = assertion.getSaml1().getIssueInstant();
}
if (validFrom != null && validFrom.isAfterNow()) {
LOG.log(Level.WARNING, "SAML Token condition not met");
return false;
} else if (validTill != null && validTill.isBeforeNow()) {
LOG.log(Level.WARNING, "SAML Token condition not met");
validateTarget.setState(STATE.EXPIRED);
return false;
}
if (issueInstant != null && issueInstant.isAfterNow()) {
LOG.log(Level.WARNING, "SAML Token IssueInstant not met");
return false;
}
return true;
}
代码示例来源:origin: org.pac4j/pac4j-saml
/**
* Validate the given assertion:
* - issueInstant
* - issuer
* - subject
* - conditions
* - authnStatements
* - signature
*
* @param assertion the assertion
* @param context the context
* @param engine the engine
* @param decrypter the decrypter
*/
protected final void validateAssertion(final Assertion assertion, final SAML2MessageContext context,
final SignatureTrustEngine engine, final Decrypter decrypter) {
validateIssueInstant(assertion.getIssueInstant());
validateIssuer(assertion.getIssuer(), context);
if (assertion.getSubject() != null) {
validateSubject(assertion.getSubject(), context, decrypter);
} else {
throw new SAMAssertionSubjectException("Assertion subject cannot be null");
}
validateAssertionConditions(assertion.getConditions(), context);
validateAuthenticationStatements(assertion.getAuthnStatements(), context);
validateAssertionSignature(assertion.getSignature(), context, engine);
}
代码示例来源:origin: spring-projects/spring-security-saml
protected Assertion resolveAssertion(
org.opensaml.saml.saml2.core.Assertion parsed,
List<SimpleKey> verificationKeys,
List<SimpleKey> localKeys
) {
Signature signature = validateSignature(parsed, verificationKeys);
return new Assertion()
.setSignature(signature)
.setId(parsed.getID())
.setIssueInstant(parsed.getIssueInstant())
.setVersion(parsed.getVersion().toString())
.setIssuer(getIssuer(parsed.getIssuer()))
.setSubject(getSubject(parsed.getSubject(), localKeys))
.setConditions(getConditions(parsed.getConditions()))
.setAuthenticationStatements(getAuthenticationStatements(parsed.getAuthnStatements()))
.setAttributes(getAttributes(parsed.getAttributeStatements(), localKeys))
;
}
内容来源于网络,如有侵权,请联系作者删除!