本文整理汇总了Java中org.opensaml.saml.saml2.core.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.opensaml.saml.saml2.core包,在下文中一共展示了Status类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: formatAuthnResponse
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
public String formatAuthnResponse(Response samlResponse, Direction direction, Boolean validSignature) {
Issuer issuer = samlResponse.getIssuer();
String issuerString = issuer != null ? issuer.getValue() : "";
Status status = samlResponse.getStatus();
StatusCode subStatusCode = status.getStatusCode().getStatusCode();
String subStatus = subStatusCode != null ? subStatusCode.getValue() : "";
return String.format(AUTHN_RESPONSE,
samlResponse.getID(),
samlResponse.getInResponseTo(),
direction,
samlResponse.getDestination(),
issuerString,
validSignature,
status.getStatusCode().getValue(),
subStatus,
getStatusDetailValues(status));
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:20,代码来源:ProtectiveMonitoringLogFormatter.java
示例2: shouldReturnADtoWhenResponseIs_Match
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldReturnADtoWhenResponseIs_Match() throws Exception {
final String requestId = "requestId";
final String msaStatusCode = SamlStatusCode.MATCH;
final Status status = aStatus().withStatusCode(aStatusCode().withSubStatusCode(aStatusCode().withValue(msaStatusCode).build()).withValue(SUCCESS).build()).build();
final SamlResponseDto samlResponseDto = new SamlResponseDto(Base64.encodeAsString(aValidMatchResponseFromMatchingService(requestId, status)));
Response clientResponse = postToSamlEngine(samlResponseDto);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = clientResponse.readEntity(InboundResponseFromMatchingServiceDto.class);
assertThat(inboundResponseFromMatchingServiceDto.getIssuer()).isEqualTo(TEST_RP_MS);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(requestId);
assertThat(inboundResponseFromMatchingServiceDto.getStatus().name()).isEqualTo(MatchingServiceIdaStatus.MatchingServiceMatch.name());
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().get()).isEqualTo(LevelOfAssurance.LEVEL_2);
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().isPresent()).isTrue();
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:19,代码来源:MatchingServiceResponseTranslatorResourceTest.java
示例3: shouldReturnADtoWhenResponseIs_NoMatch
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldReturnADtoWhenResponseIs_NoMatch() throws Exception {
final String requestId = "requestId";
final String msaStatusCode = SamlStatusCode.NO_MATCH;
final Status status = aStatus().withStatusCode(aStatusCode().withSubStatusCode(aStatusCode().withValue(msaStatusCode).build()).withValue(RESPONDER).build()).build();
final SamlResponseDto samlResponseDto = new SamlResponseDto(Base64.encodeAsString(aValidNoMatchResponseFromMatchingService(requestId, status, TEST_RP_MS)));
Response clientResponse = postToSamlEngine(samlResponseDto);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = clientResponse.readEntity(InboundResponseFromMatchingServiceDto.class);
assertThat(inboundResponseFromMatchingServiceDto.getIssuer()).isEqualTo(TEST_RP_MS);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(requestId);
assertThat(inboundResponseFromMatchingServiceDto.getStatus().name()).isEqualTo(MatchingServiceIdaStatus.NoMatchingServiceMatchFromMatchingService.name());
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().isPresent()).isFalse();
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().isPresent()).isFalse();
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:18,代码来源:MatchingServiceResponseTranslatorResourceTest.java
示例4: shouldReturnADtoWhenResponseIs_RequesterError
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldReturnADtoWhenResponseIs_RequesterError() throws Exception {
final String requestId = "requestId";
final String msaStatusCode = StatusCode.NO_AUTHN_CONTEXT;
final Status status = aStatus().withStatusCode(aStatusCode().withSubStatusCode(aStatusCode().withValue(msaStatusCode).build()).withValue(REQUESTER).build()).build();
final SamlResponseDto samlResponseDto = new SamlResponseDto(Base64.encodeAsString(aValidNoMatchResponseFromMatchingService(requestId, status, TEST_RP_MS)));
Response clientResponse = postToSamlEngine(samlResponseDto);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = clientResponse.readEntity(InboundResponseFromMatchingServiceDto.class);
assertThat(inboundResponseFromMatchingServiceDto.getIssuer()).isEqualTo(TEST_RP_MS);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(requestId);
assertThat(inboundResponseFromMatchingServiceDto.getStatus().name()).isEqualTo(MatchingServiceIdaStatus.RequesterError.name());
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().isPresent()).isFalse();
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().isPresent()).isFalse();
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:18,代码来源:MatchingServiceResponseTranslatorResourceTest.java
示例5: shouldReturnADtoWhenResponseIs_Created
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldReturnADtoWhenResponseIs_Created() throws Exception {
final String requestId = "requestId";
final String msaStatusCode = SamlStatusCode.CREATED;
final Status status = aStatus().withStatusCode(aStatusCode().withSubStatusCode(aStatusCode().withValue(msaStatusCode).build()).withValue(SUCCESS).build()).build();
final SamlResponseDto samlResponseDto = new SamlResponseDto(Base64.encodeAsString(aValidMatchResponseFromMatchingService(requestId, status)));
Response clientResponse = postToSamlEngine(samlResponseDto);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = clientResponse.readEntity(InboundResponseFromMatchingServiceDto.class);
assertThat(inboundResponseFromMatchingServiceDto.getIssuer()).isEqualTo(TEST_RP_MS);
assertThat(inboundResponseFromMatchingServiceDto.getInResponseTo()).isEqualTo(requestId);
assertThat(inboundResponseFromMatchingServiceDto.getStatus().name()).isEqualTo(MatchingServiceIdaStatus.UserAccountCreated.name());
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().isPresent()).isTrue();
assertThat(inboundResponseFromMatchingServiceDto.getLevelOfAssurance().get()).isEqualTo(LevelOfAssurance.LEVEL_2);
assertThat(inboundResponseFromMatchingServiceDto.getUnderlyingMatchingServiceAssertionBlob().isPresent()).isTrue();
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:19,代码来源:MatchingServiceResponseTranslatorResourceTest.java
示例6: shouldNotReturnADtoWhenResponseIs_Nonsense
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldNotReturnADtoWhenResponseIs_Nonsense() {
final SamlResponseDto samlResponseDto = new SamlResponseDto(StringUtils.rightPad("test", 2000, "x"));
Response clientResponse = postToSamlEngine(samlResponseDto);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
ErrorStatusDto errorStatusDto = clientResponse.readEntity(ErrorStatusDto.class);
assertThat(errorStatusDto.getExceptionType()).isEqualTo(ExceptionType.INVALID_SAML);
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:11,代码来源:MatchingServiceResponseTranslatorResourceTest.java
示例7: handleResponseFromIdp_shouldThrowExceptionIfAuthnStatementAssertionIsReplayedInResponseFromIdp
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void handleResponseFromIdp_shouldThrowExceptionIfAuthnStatementAssertionIsReplayedInResponseFromIdp() throws Exception {
String authnStatementAssertionId = "authnStatementAssertionId" + UUID.randomUUID().toString();
String mdsStatementAssertionId = "mdsStatementAssertionId" + UUID.randomUUID().toString();
SamlAuthnResponseTranslatorDto samlResponseDto_1 = getSuccessSamlAuthnResponseTranslatorDto(STUB_IDP_ONE, authnStatementAssertionId, mdsStatementAssertionId + "-1");
SamlAuthnResponseTranslatorDto samlResponseDto_2 = getSuccessSamlAuthnResponseTranslatorDto(STUB_IDP_ONE, authnStatementAssertionId, mdsStatementAssertionId + "-2");
Response clientResponse = postToSamlEngine(samlResponseDto_1);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
clientResponse = postToSamlEngine(samlResponseDto_2);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
ErrorStatusDto errorStatusDto = clientResponse.readEntity(ErrorStatusDto.class);
assertThat(errorStatusDto.getExceptionType()).isEqualTo(ExceptionType.INVALID_SAML);
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:18,代码来源:IdpAuthnResponseTranslatorResourceTest.java
示例8: handleResponseFromIdp_shouldThrowExceptionIfmdsAssertionIsReplayedInResponseFromIdp
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void handleResponseFromIdp_shouldThrowExceptionIfmdsAssertionIsReplayedInResponseFromIdp() throws Exception {
String authnStatementAssertionId = "authnStatementAssertionId" + UUID.randomUUID().toString();
String mdsStatementAssertionId = "mdsStatementAssertionId" + UUID.randomUUID().toString();
SamlAuthnResponseTranslatorDto samlResponseDto_1 = getSuccessSamlAuthnResponseTranslatorDto(STUB_IDP_ONE, authnStatementAssertionId + "-1", mdsStatementAssertionId);
SamlAuthnResponseTranslatorDto samlResponseDto_2 = getSuccessSamlAuthnResponseTranslatorDto(STUB_IDP_ONE, authnStatementAssertionId + "-2", mdsStatementAssertionId);
Response clientResponse = postToSamlEngine(samlResponseDto_1);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
clientResponse = postToSamlEngine(samlResponseDto_2);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
ErrorStatusDto errorStatusDto = clientResponse.readEntity(ErrorStatusDto.class);
assertThat(errorStatusDto.getExceptionType()).isEqualTo(ExceptionType.INVALID_SAML);
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:18,代码来源:IdpAuthnResponseTranslatorResourceTest.java
示例9: getSuccessSamlAuthnResponseTranslatorDto
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void handleResponseFromIdp_shouldProcessSecondAssertionIfTwoAssertionsHaveTheSameIdButTheFirstAssertionHasExpired() throws Exception {
String authnStatementAssertionId = "authnStatementAssertionId" + UUID.randomUUID().toString();
String mdsStatementAssertionId = "mdsStatementAssertionId" + UUID.randomUUID().toString();
DateTimeFreezer.freezeTime(DateTime.now().minusMinutes(30));
SamlAuthnResponseTranslatorDto samlResponseDto_1 = getSuccessSamlAuthnResponseTranslatorDto(STUB_IDP_ONE, authnStatementAssertionId, mdsStatementAssertionId);
Response clientResponse = postToSamlEngine(samlResponseDto_1);
DateTimeFreezer.unfreezeTime();
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
SamlAuthnResponseTranslatorDto samlResponseDto_2 = getSuccessSamlAuthnResponseTranslatorDto(STUB_IDP_ONE, authnStatementAssertionId, mdsStatementAssertionId);
clientResponse = postToSamlEngine(samlResponseDto_2);
assertThat(clientResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:18,代码来源:IdpAuthnResponseTranslatorResourceTest.java
示例10: shouldHandleSuccessMatchSaml
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldHandleSuccessMatchSaml() throws Exception {
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status successStatus = aStatus().
withStatusCode(aStatusCode().withValue(StatusCode.SUCCESS).build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(successStatus), testRpSigningCredential);
TranslatedResponseBody result = responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result).isEqualTo(new TranslatedResponseBody(
SUCCESS_MATCH,
"some-pid",
LevelOfAssurance.LEVEL_2,
null
));
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:25,代码来源:ResponseServiceTest.java
示例11: shouldHandleAccountCreationSaml
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldHandleAccountCreationSaml() throws Exception {
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status successStatus = aStatus().
withStatusCode(aStatusCode().withValue(StatusCode.SUCCESS).build())
.build();
Response response = signResponse(createAttributeResponseBuilder(successStatus), testRpSigningCredential);
TranslatedResponseBody result = responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(ACCOUNT_CREATION);
assertThat(result.getAttributes()).isNotNull();
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:21,代码来源:ResponseServiceTest.java
示例12: shouldHandleNoMatchSaml
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldHandleNoMatchSaml() throws Exception {
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status noMatchStatus = aStatus().
withStatusCode(
aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(SamlStatusCode.NO_MATCH).build())
.build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(noMatchStatus), testRpSigningCredential);
TranslatedResponseBody result = responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(NO_MATCH);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:24,代码来源:ResponseServiceTest.java
示例13: shouldHandleRequestErrorSaml
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldHandleRequestErrorSaml() throws Exception {
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status noMatchStatus = aStatus().
withStatusCode(
aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.REQUESTER).build())
.build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(noMatchStatus), testRpSigningCredential);
TranslatedResponseBody result = responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(REQUEST_ERROR);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:24,代码来源:ResponseServiceTest.java
示例14: shouldHandleNoAuthnContextSaml
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldHandleNoAuthnContextSaml() throws Exception {
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status noMatchStatus = aStatus().
withStatusCode(
aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.NO_AUTHN_CONTEXT).build())
.build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(noMatchStatus), testRpSigningCredential);
TranslatedResponseBody result = responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(CANCELLATION);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:24,代码来源:ResponseServiceTest.java
示例15: shouldHandleAuthenticationFailedSaml
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldHandleAuthenticationFailedSaml() throws Exception {
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status noMatchStatus = aStatus().
withStatusCode(
aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.AUTHN_FAILED).build())
.build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(noMatchStatus), testRpSigningCredential);
TranslatedResponseBody result = responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(AUTHENTICATION_FAILED);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:24,代码来源:ResponseServiceTest.java
示例16: shouldFailWhenUnrecognizedStatus
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldFailWhenUnrecognizedStatus() throws Exception {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage("Unknown SAML status: UNKNOWN");
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status noMatchStatus = aStatus().
withStatusCode(
aStatusCode()
.withValue("UNKNOWN")
.build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(noMatchStatus), testRpSigningCredential);
responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:24,代码来源:ResponseServiceTest.java
示例17: shouldFailWhenUnrecognizedSubStatus
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldFailWhenUnrecognizedSubStatus() throws Exception {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage("Unknown SAML sub-status: UNKNOWN");
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status noMatchStatus = aStatus().
withStatusCode(
aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue("UNKNOWN").build())
.build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(noMatchStatus), testRpSigningCredential);
responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:25,代码来源:ResponseServiceTest.java
示例18: shouldFailValidationWhenMetadataDoesNotContainCorrectCertificate
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldFailValidationWhenMetadataDoesNotContainCorrectCertificate() throws Exception {
expectedException.expect(SamlTransformationErrorException.class);
expectedException.expectMessage("SAML Validation Specification: Signature was not valid.");
Status successStatus = aStatus().
withStatusCode(aStatusCode().withValue(StatusCode.SUCCESS).build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(successStatus), testRpSigningCredential);
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_PUBLIC_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:21,代码来源:ResponseServiceTest.java
示例19: shouldFailValidationWhenResponseIsNotSigned
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldFailValidationWhenResponseIsNotSigned() throws Exception {
expectedException.expect(SamlTransformationErrorException.class);
expectedException.expectMessage("SAML Validation Specification: Message signature is not signed");
Status successStatus = aStatus().
withStatusCode(aStatusCode().withValue(StatusCode.SUCCESS).build())
.build();
Response response = createNoAttributeResponseBuilder(successStatus).withoutSigning().build();
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:21,代码来源:ResponseServiceTest.java
示例20: shouldFailWhenInResponseToDoesNotMatchRequestId
import org.opensaml.saml.saml2.core.Status; //导入依赖的package包/类
@Test
public void shouldFailWhenInResponseToDoesNotMatchRequestId() throws Exception {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage("Expected InResponseTo to be some-incorrect-request-id, but was default-request-id");
EntityDescriptor entityDescriptor = createEntityDescriptorWithSigningCertificate(TEST_RP_PUBLIC_SIGNING_CERT);
when(hubMetadataResolver.resolve(any())).thenReturn(ImmutableList.of(entityDescriptor));
Status successStatus = aStatus().
withStatusCode(aStatusCode().withValue(StatusCode.SUCCESS).build())
.build();
Response response = signResponse(createNoAttributeResponseBuilder(successStatus), testRpSigningCredential);
responseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
"some-incorrect-request-id",
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:21,代码来源:ResponseServiceTest.java
注:本文中的org.opensaml.saml.saml2.core.Status类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论