use of com.forgerock.openbanking.common.model.rcs.RedirectionAction in project openbanking-aspsp by OpenBankingToolkit.
the class RCSErrorServiceTest method invalidConsentError.
@Test
public void invalidConsentError() throws Exception {
// Given
String consentJWT = "eyJ0eXAiOiJKV1QiLCJraWQiOiJ3VTNpZklJYUxPVUFSZVJCL0ZHNmVNMVAxUU09IiwiYWxnIjoiUFMyNTYifQ.eyJjbGllbnRJZCI6IjM3M2MyYzE3LTczNDEtNDRhMy04NzMyLWIxZGI1ZDBkMTAxMCIsImlzcyI6Imh0dHBzOi8vbWF0bHMuYXMuYXNwc3AuZGV2LW9iLmZvcmdlcm9jay5maW5hbmNpYWw6ODA3NC9vYXV0aDIiLCJjc3JmIjoiSkR5SzM3cFlvQmY1RkJHR1ptYVFnZWhCbUQ3YzNMM2I1cHozSVNNeThTZz0iLCJjbGllbnRfZGVzY3JpcHRpb24iOiIiLCJhdWQiOiJmb3JnZXJvY2stcmNzIiwic2F2ZV9jb25zZW50X2VuYWJsZWQiOmZhbHNlLCJjbGFpbXMiOnsidXNlcl9pbmZvIjp7ImFjciI6eyJ2YWx1ZSI6InVybjpvcGVuYmFua2luZzpwc2QyOnNjYSIsImVzc2VudGlhbCI6dHJ1ZX0sIm9wZW5iYW5raW5nX2ludGVudF9pZCI6eyJ2YWx1ZSI6IlBEU0NfN2I4NWRhMDgtMmZjOC00ZTQxLWI3YjItYjY1MjQ3NDBmMDQiLCJlc3NlbnRpYWwiOnRydWV9fSwiaWRfdG9rZW4iOnsiYWNyIjp7InZhbHVlIjoidXJuOm9wZW5iYW5raW5nOnBzZDI6c2NhIiwiZXNzZW50aWFsIjp0cnVlfSwib3BlbmJhbmtpbmdfaW50ZW50X2lkIjp7InZhbHVlIjoiUERTQ183Yjg1ZGEwOC0yZmM4LTRlNDEtYjdiMi1iNjUyNDc0MGYwNCIsImVzc2VudGlhbCI6dHJ1ZX19fSwic2NvcGVzIjp7ImZ1bmRzY29uZmlybWF0aW9ucyI6ImZ1bmRzY29uZmlybWF0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= new OBErrorException(OBRIErrorType.RCS_CONSENT_REQUEST_INVALID, "No intent ID");
// When
ResponseEntity<RedirectionAction> response = rcsErrorService.invalidConsentError(consentJWT, obErrorException);
// Then
UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl("https://www.google.com").fragment("error=invalid_request_object&state=10d260bf-a7d9-444a-92d9-7b7a5f088208&error_description=" + String.format(obErrorException.getOBError().getMessage(), obErrorException.getArgs())).encode().build();
// we expect httpStatus.OK to redirect from UI
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
RedirectionAction body = Objects.requireNonNull(response.getBody());
assertThat(body.getRedirectUri()).isEqualTo(uriComponents.toUriString());
}
Aggregations