本文整理汇总了Java中org.opensaml.saml2.core.AuthnStatement.setSubjectLocality方法的典型用法代码示例。如果您正苦于以下问题:Java AuthnStatement.setSubjectLocality方法的具体用法?Java AuthnStatement.setSubjectLocality怎么用?Java AuthnStatement.setSubjectLocality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml2.core.AuthnStatement
的用法示例。
在下文中一共展示了AuthnStatement.setSubjectLocality方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processChildElement
import org.opensaml.saml2.core.AuthnStatement; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
AuthnStatement authnStatement = (AuthnStatement) parentObject;
if (childObject instanceof SubjectLocality) {
authnStatement.setSubjectLocality((SubjectLocality) childObject);
} else if (childObject instanceof AuthnContext) {
authnStatement.setAuthnContext((AuthnContext) childObject);
} else {
super.processChildElement(parentObject, childObject);
}
}
示例2: testChildElementsMarshall
import org.opensaml.saml2.core.AuthnStatement; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
QName qname = new QName(SAMLConstants.SAML20_NS, AuthnStatement.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
AuthnStatement authnStatement = (AuthnStatement) buildXMLObject(qname);
QName subjectLocalityQName = new QName(SAMLConstants.SAML20_NS, SubjectLocality.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
authnStatement.setSubjectLocality((SubjectLocality) buildXMLObject(subjectLocalityQName));
QName authnContextQName = new QName(SAMLConstants.SAML20_NS, AuthnContext.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
authnStatement.setAuthnContext((AuthnContext) buildXMLObject(authnContextQName));
assertEquals(expectedChildElementsDOM, authnStatement);
}
示例3: createAuthnStatement
import org.opensaml.saml2.core.AuthnStatement; //导入方法依赖的package包/类
private static AuthnStatement createAuthnStatement() {
AuthnStatement authnStatement = null;
AuthnContext authnContext = null;
SubjectLocality subjectLocality = null;
if (samlResponseData.getAuthnContextClassRef() != null
&& samlResponseData.getAuthnContextClassRef().length() > 0) {
authnContext = create(AuthnContext.DEFAULT_ELEMENT_NAME);
AuthnContextClassRef authnContextClassRef = create(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
if (samlResponseData.getAuthnContextClassRef().equals(
SamlResponseData.REPLACE_WITH_AUTHN_REQUEST)) {
authnContextClassRef.setAuthnContextClassRef(authnRequest
.getRequestedAuthnContext().getAuthnContextClassRefs()
.get(0).getAuthnContextClassRef());
} else {
authnContextClassRef.setAuthnContextClassRef(samlResponseData
.getAuthnContextClassRef());
}
authnContext.setAuthnContextClassRef(authnContextClassRef);
}
if (samlResponseData.getSubjectLocalityAddress() != null
&& samlResponseData.getSubjectLocalityAddress().length() > 0) {
subjectLocality = create(SubjectLocality.DEFAULT_ELEMENT_NAME);
subjectLocality.setAddress(samlResponseData
.getSubjectLocalityAddress());
}
if (samlResponseData.getSubjectLocalityDNSName() != null
&& samlResponseData.getSubjectLocalityDNSName().length() > 0) {
if (subjectLocality == null)
subjectLocality = create(SubjectLocality.DEFAULT_ELEMENT_NAME);
subjectLocality.setDNSName(samlResponseData
.getSubjectLocalityDNSName());
}
if (authnContext != null || subjectLocality != null
|| samlResponseData.getAuthnInstant() != null) {
authnStatement = create(AuthnStatement.DEFAULT_ELEMENT_NAME);
if (samlResponseData.getAuthnInstant() != null) {
authnStatement.setAuthnInstant(startTime
.plusMinutes(samlResponseData.getAuthnInstant()));
}
authnStatement.setSessionIndex(GENERATOR.generateIdentifier());
authnStatement.setAuthnContext(authnContext);
authnStatement.setSubjectLocality(subjectLocality);
}
return authnStatement;
}