本文整理汇总了Java中org.opensaml.saml2.core.SubjectConfirmationData.setNotBefore方法的典型用法代码示例。如果您正苦于以下问题:Java SubjectConfirmationData.setNotBefore方法的具体用法?Java SubjectConfirmationData.setNotBefore怎么用?Java SubjectConfirmationData.setNotBefore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml2.core.SubjectConfirmationData
的用法示例。
在下文中一共展示了SubjectConfirmationData.setNotBefore方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAttribute
import org.opensaml.saml2.core.SubjectConfirmationData; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
SubjectConfirmationData subjectCD = (SubjectConfirmationData) samlObject;
if (attribute.getLocalName().equals(SubjectConfirmationData.NOT_BEFORE_ATTRIB_NAME)
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
subjectCD.setNotBefore(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (attribute.getLocalName().equals(SubjectConfirmationData.NOT_ON_OR_AFTER_ATTRIB_NAME)
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
subjectCD.setNotOnOrAfter(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
} else if (attribute.getLocalName().equals(SubjectConfirmationData.RECIPIENT_ATTRIB_NAME)) {
subjectCD.setRecipient(attribute.getValue());
} else if (attribute.getLocalName().equals(SubjectConfirmationData.IN_RESPONSE_TO_ATTRIB_NAME)) {
subjectCD.setInResponseTo(attribute.getValue());
} else if (attribute.getLocalName().equals(SubjectConfirmationData.ADDRESS_ATTRIB_NAME)) {
subjectCD.setAddress(attribute.getValue());
} else {
QName attribQName = XMLHelper.getNodeQName(attribute);
if (attribute.isId()) {
subjectCD.getUnknownAttributes().registerID(attribQName);
}
subjectCD.getUnknownAttributes().put(attribQName, attribute.getValue());
}
}
示例2: testSingleElementMarshall
import org.opensaml.saml2.core.SubjectConfirmationData; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
QName qname = new QName(SAMLConstants.SAML20_NS, SubjectConfirmationData.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
SubjectConfirmationData subjectCD = (SubjectConfirmationData) buildXMLObject(qname);
subjectCD.setNotBefore(expectedNotBefore);
assertEquals(expectedDOM, subjectCD);
}
示例3: testSingleElementOptionalAttributesMarshall
import org.opensaml.saml2.core.SubjectConfirmationData; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
QName qname = new QName(SAMLConstants.SAML20_NS, SubjectConfirmationData.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20_PREFIX);
SubjectConfirmationData subjectCD = (SubjectConfirmationData) buildXMLObject(qname);
subjectCD.setNotBefore(expectedNotBefore);
subjectCD.setNotOnOrAfter(expectedNotOnOrAfter);
subjectCD.setRecipient(expectedRecipient);
subjectCD.setInResponseTo(expectedInResponseTo);
subjectCD.setAddress(expectedAddress);
assertEquals(expectedOptionalAttributesDOM, subjectCD);
}
示例4: buildSubjectConfirmation
import org.opensaml.saml2.core.SubjectConfirmationData; //导入方法依赖的package包/类
private SubjectConfirmation buildSubjectConfirmation() throws IllegalAccessException, MetadataProviderException {
SubjectConfirmation subjectConfirmation = buildXMLObjectDefaultName(SubjectConfirmation.class);
subjectConfirmation.setMethod(SubjectConfirmation.METHOD_BEARER);
SubjectConfirmationData subjectConfirmationData = buildXMLObjectDefaultName(SubjectConfirmationData.class);
subjectConfirmationData.setInResponseTo(MockIDPAuthnReq.authnReqId);
subjectConfirmationData.setNotBefore(new DateTime().minusDays(2));
subjectConfirmationData.setNotOnOrAfter(new DateTime().plusDays(2));
subjectConfirmationData.setRecipient(MockIDPSPMetadata.getSpConsumerUrl());
subjectConfirmation.setSubjectConfirmationData(subjectConfirmationData);
return subjectConfirmation;
}
示例5: createSubject
import org.opensaml.saml2.core.SubjectConfirmationData; //导入方法依赖的package包/类
private static Subject createSubject() {
Subject subject = null;
NameID nameID = createNameID(samlResponseData.getSubjectValue(),
samlResponseData.getSubjectFormat());
if (nameID != null
|| samlResponseData.getSubjectNotOnOrAfter() != null
|| samlResponseData.getSubjectNotBefore() != null
|| (samlResponseData.getSubjectInResponseTo() != null && samlResponseData
.getSubjectInResponseTo().length() > 0)
|| (samlResponseData.getSubjectRecipient() != null && samlResponseData
.getSubjectRecipient().length() > 0)) {
subject = create(Subject.DEFAULT_ELEMENT_NAME);
subject.setNameID(nameID);
SubjectConfirmationData subjectConfirmationData = create(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
if (SamlResponseData.REPLACE_WITH_AUTHN_REQUEST
.equals(samlResponseData.getSubjectInResponseTo()))
subjectConfirmationData.setInResponseTo(authnRequest.getID());
else
subjectConfirmationData.setInResponseTo(samlResponseData
.getSubjectInResponseTo());
if (samlResponseData.getSubjectNotOnOrAfter() != null)
subjectConfirmationData
.setNotOnOrAfter(startTime.plusMinutes(samlResponseData
.getSubjectNotOnOrAfter()));
if (samlResponseData.getSubjectNotBefore() != null)
subjectConfirmationData.setNotBefore(startTime
.plusMinutes(samlResponseData.getSubjectNotBefore()));
if (SamlResponseData.REPLACE_WITH_AUTHN_REQUEST
.equals(samlResponseData.getSubjectRecipient()))
subjectConfirmationData.setRecipient(authnRequest
.getAssertionConsumerServiceURL());
else
subjectConfirmationData.setRecipient(samlResponseData
.getSubjectRecipient());
SubjectConfirmation subjectConfirmation = create(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
subjectConfirmation.setMethod(SubjectConfirmation.METHOD_BEARER);
subjectConfirmation
.setSubjectConfirmationData(subjectConfirmationData);
subject.getSubjectConfirmations().add(subjectConfirmation);
}
return subject;
}