本文整理汇总了Java中org.opensaml.saml.saml2.core.Audience.setAudienceURI方法的典型用法代码示例。如果您正苦于以下问题:Java Audience.setAudienceURI方法的具体用法?Java Audience.setAudienceURI怎么用?Java Audience.setAudienceURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml.saml2.core.Audience
的用法示例。
在下文中一共展示了Audience.setAudienceURI方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newConditions
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
/**
* New conditions element.
*
* @param notBefore the not before
* @param notOnOrAfter the not on or after
* @param audienceUri the service id
* @return the conditions
*/
public Conditions newConditions(final DateTime notBefore, final DateTime notOnOrAfter, final String audienceUri) {
final Conditions conditions = newSamlObject(Conditions.class);
conditions.setNotBefore(notBefore);
conditions.setNotOnOrAfter(notOnOrAfter);
final AudienceRestriction audienceRestriction = newSamlObject(AudienceRestriction.class);
final Audience audience = newSamlObject(Audience.class);
audience.setAudienceURI(audienceUri);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictions().add(audienceRestriction);
return conditions;
}
示例2: newConditions
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
/**
* New conditions element.
*
* @param notBefore the not before
* @param notOnOrAfter the not on or after
* @param audienceUri the service id
* @return the conditions
*/
public Conditions newConditions(final ZonedDateTime notBefore, final ZonedDateTime notOnOrAfter, final String audienceUri) {
LOGGER.debug("Building conditions for audience [{}] that enforce not-before [{}] and not-after [{}]", audienceUri, notBefore, notOnOrAfter);
final Conditions conditions = newSamlObject(Conditions.class);
conditions.setNotBefore(DateTimeUtils.dateTimeOf(notBefore));
conditions.setNotOnOrAfter(DateTimeUtils.dateTimeOf(notOnOrAfter));
final AudienceRestriction audienceRestriction = newSamlObject(AudienceRestriction.class);
final Audience audience = newSamlObject(Audience.class);
audience.setAudienceURI(audienceUri);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictions().add(audienceRestriction);
return conditions;
}
示例3: shouldNotComplainWhenCorrectDataIsPassed
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Test
public void shouldNotComplainWhenCorrectDataIsPassed() {
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI("some-entity-id");
AudienceRestriction audienceRestriction = mock(AudienceRestriction.class, Answers.RETURNS_DEEP_STUBS);
when(audienceRestriction.getAudiences()).thenReturn(ImmutableList.of(audience));
validator.validate(ImmutableList.of(audienceRestriction), "some-entity-id");
}
示例4: shouldThrowExceptionWhenAudienceUriDoesNotMatchTheEntityId
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Test
public void shouldThrowExceptionWhenAudienceUriDoesNotMatchTheEntityId() {
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI("some-entity-id");
AudienceRestriction audienceRestriction = mock(AudienceRestriction.class, Answers.RETURNS_DEEP_STUBS);
when(audienceRestriction.getAudiences()).thenReturn(ImmutableList.of(audience));
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage(String.format("Audience must match entity ID. Expected %s but was %s", "unknown-entity-id", "some-entity-id"));
validator.validate(ImmutableList.of(audienceRestriction), "unknown-entity-id");
}
示例5: aConditions
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
private static Conditions aConditions() {
Conditions conditions = new ConditionsBuilder().buildObject();
conditions.setNotBefore(DateTime.now());
conditions.setNotOnOrAfter(DateTime.now().plusMinutes(10));
AudienceRestriction audienceRestriction= new AudienceRestrictionBuilder().buildObject();
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(HUB_SECONDARY_ENTITY_ID);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictions().add(audienceRestriction);
return conditions;
}
示例6: aConditions
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
private static Conditions aConditions() {
Conditions conditions = new ConditionsBuilder().buildObject();
conditions.setNotBefore(DateTime.now());
conditions.setNotOnOrAfter(DateTime.now().plusMinutes(10));
AudienceRestriction audienceRestriction = new AudienceRestrictionBuilder().buildObject();
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(HUB_SECONDARY_ENTITY_ID);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictions().add(audienceRestriction);
return conditions;
}
示例7: shouldReturnErrorIfAudienceUriIsEmpty
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Test
public void shouldReturnErrorIfAudienceUriIsEmpty() {
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI("");
Messages messages = validator.validate(audience, messages());
assertThat(messages.size()).isEqualTo(1);
assertThat(messages.hasErrorLike(DEFAULT_REQUIRED_URI_MESSAGE)).isTrue();
}
示例8: shouldReturnErrorIfAudienceUriDoesNotMatchExpectedEntityId
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Test
public void shouldReturnErrorIfAudienceUriDoesNotMatchExpectedEntityId() {
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI("invalidEntityId");
Messages messages = validator.validate(audience, messages());
assertThat(messages.size()).isEqualTo(1);
assertThat(messages.hasErrorLike(generateMismatchedAudienceUriMessage(AUDIENCE_URI))).isTrue();
}
示例9: shouldValidateAudienceUriSuccessfully
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Test
public void shouldValidateAudienceUriSuccessfully() {
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(AUDIENCE_URI);
Messages messages = validator.validate(audience, messages());
assertThat(messages.size()).isEqualTo(0);
assertThat(messages.hasErrors()).isFalse();
}
示例10: setUp
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
DateTimeUtils.setCurrentMillisFixed(NOW.getMillis());
validator = new ConditionsValidator<>(conditions -> conditions, AUDIENCE_URI);
audienceRestriction= new AudienceRestrictionBuilder().buildObject();
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(AUDIENCE_URI);
audienceRestriction.getAudiences().add(audience);
}
示例11: aConditions
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
private Conditions aConditions() {
Conditions conditions = new ConditionsBuilder().buildObject();
conditions.setNotBefore(DateTime.now());
conditions.setNotOnOrAfter(DateTime.now().plusMinutes(10));
AudienceRestriction audienceRestriction= new AudienceRestrictionBuilder().buildObject();
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(HUB_CONNECTOR_ENTITY_ID);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictions().add(audienceRestriction);
return conditions;
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:12,代码来源:EidasAttributeQueryValidatorTest.java
示例12: shouldValidateAudienceRestrictionSuccessfully
import org.opensaml.saml.saml2.core.Audience; //导入方法依赖的package包/类
@Test
public void shouldValidateAudienceRestrictionSuccessfully() {
AudienceRestriction audienceRestriction= new AudienceRestrictionBuilder().buildObject();
Audience audience = new AudienceBuilder().buildObject();
audience.setAudienceURI(AUDIENCE_URI);
audienceRestriction.getAudiences().add(audience);
Messages messages = validator.validate(audienceRestriction, messages());
assertThat(messages.size()).isEqualTo(0);
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:12,代码来源:AudienceRestrictionValidatorTest.java