本文整理汇总了Java中org.opensaml.saml1.core.AuthenticationStatement.setSubject方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationStatement.setSubject方法的具体用法?Java AuthenticationStatement.setSubject怎么用?Java AuthenticationStatement.setSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml1.core.AuthenticationStatement
的用法示例。
在下文中一共展示了AuthenticationStatement.setSubject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newAuthenticationStatement
import org.opensaml.saml1.core.AuthenticationStatement; //导入方法依赖的package包/类
private AuthenticationStatement newAuthenticationStatement(final Authentication authentication) {
final String authenticationMethod = (String) authentication.getAttributes().get(
SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD);
final AuthenticationStatement authnStatement = newSamlObject(AuthenticationStatement.class);
authnStatement.setAuthenticationInstant(new DateTime(authentication.getAuthenticatedDate()));
authnStatement.setAuthenticationMethod(
authenticationMethod != null
? authenticationMethod
: SamlAuthenticationMetaDataPopulator.AUTHN_METHOD_UNSPECIFIED);
authnStatement.setSubject(newSubject(authentication.getPrincipal().getId()));
return authnStatement;
}
示例2: testChildElementsMarshall
import org.opensaml.saml1.core.AuthenticationStatement; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
AuthenticationStatement authenticationStatement = (AuthenticationStatement) buildXMLObject(qname);
authenticationStatement.setSubject((Subject) buildXMLObject(new QName(SAMLConstants.SAML1_NS, Subject.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX)));
authenticationStatement.setSubjectLocality((SubjectLocality) buildXMLObject(new QName(SAMLConstants.SAML1_NS, SubjectLocality.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX)));
QName authQname = new QName(SAMLConstants.SAML1_NS, AuthorityBinding.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
authenticationStatement.getAuthorityBindings().add((AuthorityBinding) buildXMLObject(authQname));
authenticationStatement.getAuthorityBindings().add((AuthorityBinding) buildXMLObject(authQname));
assertEquals(expectedChildElementsDOM, authenticationStatement);
}