本文整理汇总了Java中org.opensaml.saml1.core.AuthenticationStatement.setAuthenticationMethod方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationStatement.setAuthenticationMethod方法的具体用法?Java AuthenticationStatement.setAuthenticationMethod怎么用?Java AuthenticationStatement.setAuthenticationMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml1.core.AuthenticationStatement
的用法示例。
在下文中一共展示了AuthenticationStatement.setAuthenticationMethod方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: processAttribute
import org.opensaml.saml1.core.AuthenticationStatement; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
AuthenticationStatement authenticationStatement = (AuthenticationStatement) samlObject;
if (AuthenticationStatement.AUTHENTICATIONINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
&& !DatatypeHelper.isEmpty(attribute.getValue())) {
DateTime value = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC());
authenticationStatement.setAuthenticationInstant(value);
} else if (AuthenticationStatement.AUTHENTICATIONMETHOD_ATTRIB_NAME.equals(attribute.getLocalName())) {
authenticationStatement.setAuthenticationMethod(attribute.getValue());
} else {
super.processAttribute(samlObject, attribute);
}
}
示例3: populateRequiredData
import org.opensaml.saml1.core.AuthenticationStatement; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
AuthenticationStatement authenticationStatement = (AuthenticationStatement) target;
authenticationStatement.setAuthenticationInstant(new DateTime());
authenticationStatement.setAuthenticationMethod("Hi there!");
}
示例4: testSingleElementOptionalAttributesMarshall
import org.opensaml.saml1.core.AuthenticationStatement; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
AuthenticationStatement authenticationStatement = (AuthenticationStatement) buildXMLObject(qname);
authenticationStatement.setAuthenticationInstant(expectedAuthenticationInstant);
authenticationStatement.setAuthenticationMethod(expectedAuthenticationMethod);
assertEquals(expectedOptionalAttributesDOM, authenticationStatement);
}
示例5: testMissingAuthenticationMethod
import org.opensaml.saml1.core.AuthenticationStatement; //导入方法依赖的package包/类
public void testMissingAuthenticationMethod(){
AuthenticationStatement authenticationStatement = (AuthenticationStatement) target;
authenticationStatement.setAuthenticationMethod("");
assertValidationFail("No AuthenticationMethod attribute - should fail");
}