Java源码示例:org.opensaml.saml.saml2.core.StatusCode
示例1
@Override
public TranslatedResponseBody translateResponderCode(StatusCode statusCode) {
Optional.ofNullable(statusCode.getStatusCode())
.orElseThrow(() -> new SamlResponseValidationException("Missing status code for non-Success response"));
String subStatus = statusCode.getStatusCode().getValue();
switch (subStatus) {
case SamlStatusCode.NO_MATCH:
return new TranslatedMatchingResponseBody(MatchingScenario.NO_MATCH, null, null, null);
case StatusCode.REQUESTER:
return new TranslatedMatchingResponseBody(MatchingScenario.REQUEST_ERROR, null, null, null);
case StatusCode.NO_AUTHN_CONTEXT:
return new TranslatedMatchingResponseBody(MatchingScenario.CANCELLATION, null, null, null);
case StatusCode.AUTHN_FAILED:
return new TranslatedMatchingResponseBody(MatchingScenario.AUTHENTICATION_FAILED, null, null, null);
default:
throw new SamlResponseValidationException(String.format("Unknown SAML sub-status: %s", subStatus));
}
}
示例2
@Override
public TranslatedNonMatchingResponseBody translateResponderCode(StatusCode statusCode) {
Optional.ofNullable(statusCode.getStatusCode())
.orElseThrow(() -> new SamlResponseValidationException("Missing status code for non-Success response"));
String subStatus = statusCode.getStatusCode().getValue();
switch (subStatus) {
case StatusCode.REQUESTER:
return new TranslatedNonMatchingResponseBody(NonMatchingScenario.REQUEST_ERROR, null, null, null);
case StatusCode.NO_AUTHN_CONTEXT:
return new TranslatedNonMatchingResponseBody(NonMatchingScenario.NO_AUTHENTICATION, null, null, null);
case StatusCode.AUTHN_FAILED:
return new TranslatedNonMatchingResponseBody(NonMatchingScenario.AUTHENTICATION_FAILED, null, null, null);
default:
throw new SamlResponseValidationException(String.format("Unknown SAML sub-status: %s", subStatus));
}
}
示例3
@Test
public void matchingResponseServiceShouldHandleSuccessMatchSaml() 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 = matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result).isEqualTo(new TranslatedMatchingResponseBody(
SUCCESS_MATCH,
"some-pid",
LevelOfAssurance.LEVEL_2,
null
));
}
示例4
@Test
public void matchingResponseServiceShouldHandleAccountCreationSaml() 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);
TranslatedMatchingResponseBody result = (TranslatedMatchingResponseBody) matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(ACCOUNT_CREATION);
assertThat(result.getAttributes()).isNotNull();
}
示例5
@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);
TranslatedMatchingResponseBody result = (TranslatedMatchingResponseBody) matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(NO_MATCH);
}
示例6
@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);
TranslatedMatchingResponseBody result = (TranslatedMatchingResponseBody) matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(REQUEST_ERROR);
}
示例7
@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);
TranslatedMatchingResponseBody result = (TranslatedMatchingResponseBody) matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(CANCELLATION);
}
示例8
@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);
TranslatedMatchingResponseBody result = (TranslatedMatchingResponseBody) matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
assertThat(result.getScenario()).isEqualTo(AUTHENTICATION_FAILED);
}
示例9
@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);
matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
示例10
@Test
public void shouldFailValidationWhenHubMetadataDoesNotContainCorrectCertificate() 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));
matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
示例11
@Test
public void shouldFailValidationWhenHubResponseIsNotSigned() 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));
matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
response.getInResponseTo(),
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
示例12
@Test
public void shouldFailWhenInResponseToDoesNotMatchRequestId() throws Exception {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage(String.format("Expected InResponseTo to be some-incorrect-request-id, but was %s", 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);
matchingResponseService.convertTranslatedResponseBody(
responseToBase64StringTransformer.apply(response),
"some-incorrect-request-id",
LevelOfAssurance.LEVEL_2,
VERIFY_SERVICE_PROVIDER_ENTITY_ID
);
}
示例13
private ResponseBuilder createUnsignedAttributeResponseBuilder() {
return aResponse()
.withStatus(
aStatus().
withStatusCode(aStatusCode().withValue(StatusCode.SUCCESS).build())
.build())
.withNoDefaultAssertion()
.addEncryptedAssertion(aDefaultAssertion()
.addAttributeStatement(
anAttributeStatement()
.addAttribute(new SimpleStringAttributeBuilder()
.withName(IdaConstants.Eidas_Attributes.UnsignedAssertions.EidasSamlResponse.NAME)
.withSimpleStringValue("eidasSaml")
.build())
.build())
.buildWithEncrypterCredential(encryptionCredentialFactory.getEncryptingCredential())
);
}
示例14
/**
* Decode and validate saml logout response with invalid signature.
*
* @throws Throwable the throwable
*/
@Test
public void decodeAndValidateSamlLogoutResponseWithInvalidSignature() throws Throwable {
SamlClient client = getKeyCloakClient(true);
String encodedSamlLogoutResponse = client.getSamlLogoutResponse(StatusCode.SUCCESS);
//Corrupt the signature (decode => corrupt => encode)
String decodedSamlLogoutResponse = decode(encodedSamlLogoutResponse);
int index = decodedSamlLogoutResponse.indexOf("<ds:SignatureValue>") + 19;
String s = decodedSamlLogoutResponse.substring(index);
decodedSamlLogoutResponse = encode(decodedSamlLogoutResponse.subSequence(0, index) + "XXX" + s);
try {
decodeAndValidateSamlLogoutResponse(decodedSamlLogoutResponse, "POST");
fail("We must have an exception if the signature isn't valid");
} catch (SamlException ignore) {
}
}
示例15
/**
* Decode and validate saml logout response with valid signature.
*
* @throws Throwable the throwable
*/
@Test
public void decodeAndValidateSamlLogoutResponseWithValidSignature() throws Throwable {
/*
* To avoid annoying code test, the IDP and the SP have the same public key
*/
//Retrieve the saml client
SamlClient client = getKeyCloakClient(true);
//Retrieve the new encoded logout response
String encodedLogoutResponse = client.getSamlLogoutResponse(StatusCode.SUCCESS);
//Decode the encoded logout response to check it is signed
String decodedResponse = decode(encodedLogoutResponse);
assertTrue(decodedResponse.contains(Signature.DEFAULT_ELEMENT_LOCAL_NAME));
//Decode and valid the logout response
SamlLogoutResponse logoutResponse =
decodeAndValidateSamlLogoutResponse(encodedLogoutResponse, "POST");
assertTrue(logoutResponse.isValid());
}
示例16
private HttpResponse fail(ServiceRequestContext ctx,
LogoutRequest logoutRequest,
SamlEndpoint sloResEndpoint) {
// Try to send a LogoutResponse with the following status code. It's one of the top-level status code
// which is defined in SAML 2.0 specifications.
//
// "urn:oasis:names:tc:SAML:2.0:status:Responder"
// - The request could not be performed due to an error on the part of the SAML responder
// or SAML authority.
final LogoutResponse failureResponse = createLogoutResponse(logoutRequest, StatusCode.RESPONDER);
try {
return respond(failureResponse, sloResEndpoint);
} catch (SamlException e) {
return fail(ctx, e);
}
}
示例17
private LogoutResponse createLogoutResponse(LogoutRequest logoutRequest,
String statusCode) {
final StatusCode success = build(StatusCode.DEFAULT_ELEMENT_NAME);
success.setValue(statusCode);
final Status status = build(Status.DEFAULT_ELEMENT_NAME);
status.setStatusCode(success);
final Issuer me = build(Issuer.DEFAULT_ELEMENT_NAME);
me.setValue(entityId);
final LogoutResponse logoutResponse = build(LogoutResponse.DEFAULT_ELEMENT_NAME);
logoutResponse.setIssuer(me);
logoutResponse.setID(requestIdManager.newId());
logoutResponse.setIssueInstant(DateTime.now());
logoutResponse.setStatus(status);
logoutResponse.setInResponseTo(logoutRequest.getID());
return logoutResponse;
}
示例18
public static Status createStatus(final String statusCodeValue, final String statusMessage) {
if (statusBuilder == null) {
statusBuilder = new StatusBuilder();
}
if (statusCodeBuilder == null) {
statusCodeBuilder = new StatusCodeBuilder();
}
if (statusMessageBuilder == null) {
statusMessageBuilder = new StatusMessageBuilder();
}
Status status = statusBuilder.buildObject();
StatusCode statusCode = statusCodeBuilder.buildObject();
statusCode.setValue(statusCodeValue);
status.setStatusCode(statusCode);
if (statusMessage != null) {
StatusMessage statusMessageObject = statusMessageBuilder.buildObject();
statusMessageObject.setMessage(statusMessage);
status.setStatusMessage(statusMessageObject);
}
return status;
}
示例19
private Status createStatus(String statusCodeValue) {
Status status = createSamlElement(Status.class);
StatusCode statusCode = createSamlElement(StatusCode.class);
statusCode.setValue(statusCodeValue);
status.setStatusCode(statusCode);
return status;
}
示例20
/**
* Construct SAML response.
* <a href="http://bit.ly/1uI8Ggu">See this reference for more info.</a>
* @return the SAML response
*/
private String constructSamlResponse() {
final DateTime currentDateTime = DateTime.parse(new ISOStandardDateFormat().getCurrentDateAndTime());
final DateTime notBeforeIssueInstant = DateTime.parse("2003-04-17T00:46:02Z");
final RegisteredService svc = this.servicesManager.findServiceBy(this);
final String userId = svc.getUsernameAttributeProvider().resolveUsername(getPrincipal(), this);
final org.opensaml.saml.saml2.core.Response response = BUILDER.newResponse(
BUILDER.generateSecureRandomId(),
currentDateTime,
getId(), this);
response.setStatus(BUILDER.newStatus(StatusCode.SUCCESS, null));
final AuthnStatement authnStatement = BUILDER.newAuthnStatement(
AuthnContext.PASSWORD_AUTHN_CTX, currentDateTime);
final Assertion assertion = BUILDER.newAssertion(authnStatement,
"https://www.opensaml.org/IDP",
notBeforeIssueInstant, BUILDER.generateSecureRandomId());
final Conditions conditions = BUILDER.newConditions(notBeforeIssueInstant,
currentDateTime, getId());
assertion.setConditions(conditions);
final Subject subject = BUILDER.newSubject(NameID.EMAIL, userId,
getId(), currentDateTime, this.requestId);
assertion.setSubject(subject);
response.getAssertions().add(assertion);
final StringWriter writer = new StringWriter();
BUILDER.marshalSamlXmlObject(response, writer);
final String result = writer.toString();
logger.debug("Generated Google SAML response: {}", result);
return result;
}
示例21
@Override
public final QName getSamlObjectQName(final Class objectType) throws RuntimeException {
try {
final Field f = objectType.getField(DEFAULT_ELEMENT_LOCAL_NAME_FIELD);
final String name = f.get(null).toString();
if (objectType.equals(Response.class) || objectType.equals(Status.class)
|| objectType.equals(StatusCode.class)) {
return new QName(SAMLConstants.SAML20P_NS, name, "samlp");
}
return new QName(SAMLConstants.SAML20_NS, name, XMLConstants.DEFAULT_NS_PREFIX);
} catch (final Exception e){
throw new IllegalStateException("Cannot access field " + objectType.getName() + '.' + DEFAULT_ELEMENT_LOCAL_NAME_FIELD);
}
}
示例22
/**
* Create a new SAML status object.
*
* @param codeValue the code value
* @param statusMessage the status message
* @return the status
*/
public Status newStatus(final String codeValue, final String statusMessage) {
final Status status = newSamlObject(Status.class);
final StatusCode code = newSamlObject(StatusCode.class);
code.setValue(codeValue);
status.setStatusCode(code);
if (StringUtils.isNotBlank(statusMessage)) {
final StatusMessage message = newSamlObject(StatusMessage.class);
message.setMessage(statusMessage);
status.setStatusMessage(message);
}
return status;
}
示例23
public TranslatedResponseBody convertTranslatedResponseBody(
String decodedSamlResponse,
String expectedInResponseTo,
LevelOfAssurance expectedLevelOfAssurance,
String entityId
) {
Response response = samlObjectTransformer.apply(decodedSamlResponse);
ValidatedResponse validatedResponse = responseSignatureValidator.validate(response, SPSSODescriptor.DEFAULT_ELEMENT_NAME);
if (!expectedInResponseTo.equals(validatedResponse.getInResponseTo())) {
throw new SamlResponseValidationException(
String.format("Expected InResponseTo to be %s, but was %s", expectedInResponseTo, response.getInResponseTo())
);
}
instantValidator.validate(validatedResponse.getIssueInstant(), "Response IssueInstant");
StatusCode statusCode = validatedResponse.getStatus().getStatusCode();
switch (statusCode.getValue()) {
case StatusCode.RESPONDER:
return responderCodeTranslator.translateResponderCode(statusCode);
case StatusCode.SUCCESS:
List<Assertion> assertions = assertionDecrypter.decryptAssertions(validatedResponse);
if (assertionsContainEidasUnsignedAssertionsResponse(assertions)) {
if (unsignedAssertionsResponseHandler == null) { throw new MissingUnsignedAssertionsHandlerException(); }
ValidatedResponse validatedCountryResponse = unsignedAssertionsResponseHandler.getValidatedResponse(assertions, expectedInResponseTo);
assertions = unsignedAssertionsResponseHandler.decryptAssertion(validatedCountryResponse, assertions.get(ONLY_ONE_PRESENT));
}
return assertionTranslator.translateSuccessResponse(assertions, expectedInResponseTo, expectedLevelOfAssurance, entityId);
default:
throw new SamlResponseValidationException(String.format("Unknown SAML status: %s", statusCode.getValue()));
}
}
示例24
@Test
public void shouldThrowExceptionWhenNonSuccessResponseCalledWithNoSubStatusCode() {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage("Missing status code for non-Success response");
StatusCode statusCode = aStatusCode().withValue(StatusCode.RESPONDER).build();
msaAssertionService.translateResponderCode(statusCode);
}
示例25
@Test
public void shouldReturnScenarioCancelledWhenNoAuthnContextStatus() {
StatusCode statusCode = aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.NO_AUTHN_CONTEXT).build())
.build();
TranslatedResponseBody response = msaAssertionService.translateResponderCode(statusCode);
assertThat(response.getScenario()).isEqualTo(MatchingScenario.CANCELLATION);
}
示例26
@Test
public void shouldReturnScenarioNoMatchWhenNoMatchStatus() {
StatusCode statusCode = aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(SamlStatusCode.NO_MATCH).build())
.build();
TranslatedResponseBody response = msaAssertionService.translateResponderCode(statusCode);
assertThat(response.getScenario()).isEqualTo(MatchingScenario.NO_MATCH);
}
示例27
@Test
public void shouldReturnScenarioAuthenticationFailedWhenAuthnFailedStatus() {
StatusCode statusCode = aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.AUTHN_FAILED).build())
.build();
TranslatedResponseBody response = msaAssertionService.translateResponderCode(statusCode);
assertThat(response.getScenario()).isEqualTo(MatchingScenario.AUTHENTICATION_FAILED);
}
示例28
@Test
public void shouldReturnScenarioRequestErrorWhenRequesterStatus() {
StatusCode statusCode = aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.REQUESTER).build())
.build();
TranslatedResponseBody response = msaAssertionService.translateResponderCode(statusCode);
assertThat(response.getScenario()).isEqualTo(MatchingScenario.REQUEST_ERROR);
}
示例29
@Test
public void shouldThrowExceptionWhenNonSuccessResponseCalledWithUnrecognisedStatus() {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage("Unknown SAML sub-status: urn:oasis:names:tc:SAML:2.0:status:NoAvailableIDP");
StatusCode statusCode = aStatusCode()
.withValue(StatusCode.RESPONDER)
.withSubStatusCode(aStatusCode().withValue(StatusCode.NO_AVAILABLE_IDP).build())
.build();
msaAssertionService.translateResponderCode(statusCode);
}
示例30
@Test
public void shouldThrowExceptionWhenNonSuccessResponseCalledWithNoSubStatusCode() {
expectedException.expect(SamlResponseValidationException.class);
expectedException.expectMessage("Missing status code for non-Success response");
StatusCode statusCode = aStatusCode().withValue(StatusCode.RESPONDER).build();
responderResponseTranslator.translateResponderCode(statusCode);
}