Search in sources :

Example 11 with DirectorySoftwareStatement

use of com.forgerock.openbanking.model.DirectorySoftwareStatement in project openbanking-aspsp by OpenBankingToolkit.

the class TppRegistrationServiceTest method shouldFailWhenNoRedirectUrlInSsa_verifyTppRegistrationRequestAgainstSSA.

/**
 *************************** test redirect url logic ***********************************************************
 */
// ToDo: This is ignored due to issue: https://github.com/OpenBankingToolkit/openbanking-toolkit/issues/17
@Test
@Ignore
public void shouldFailWhenNoRedirectUrlInSsa_verifyTppRegistrationRequestAgainstSSA() throws DynamicClientRegistrationException {
    // Given
    DynamicClientRegistrationException dcre = new DynamicClientRegistrationException("Test throw", DynamicClientRegistrationErrorType.INVALID_REDIRECT_URI);
    DirectorySoftwareStatement directorySoftwareStatement = TestHelperFunctions.getValidFRDirectorySoftwareStatement();
    RegistrationRequest regRequest = new RegistrationRequest();
    regRequest.setSoftwareId(directorySoftwareStatement.getSoftware_client_id());
    regRequest.setRedirectUris(directorySoftwareStatement.getSoftware_redirect_uris());
    regRequest.setSoftwareStatement(TestHelperFunctions.getValidSsaSerialised());
    regRequest.setDirectorySoftwareStatement(directorySoftwareStatement);
    RegistrationRequest spyRequest = spy(regRequest);
    when(spyRequest.getRedirectUrisFromSSA()).thenReturn(Optional.empty());
    // When
    DynamicClientRegistrationException exception = catchThrowableOfType(() -> tppRegistrationService.verifyTPPRegistrationRequestAgainstSSA(spyRequest), DynamicClientRegistrationException.class);
    // Then
    assertThat(exception.getErrorType()).isEqualTo(DynamicClientRegistrationErrorType.INVALID_REDIRECT_URI);
}
Also used : DynamicClientRegistrationException(com.forgerock.openbanking.common.error.exception.dynamicclientregistration.DynamicClientRegistrationException) DirectorySoftwareStatement(com.forgerock.openbanking.model.DirectorySoftwareStatement) RegistrationRequest(com.forgerock.openbanking.common.services.onboarding.registrationrequest.RegistrationRequest) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

DirectorySoftwareStatement (com.forgerock.openbanking.model.DirectorySoftwareStatement)11 Test (org.junit.Test)5 DynamicClientRegistrationException (com.forgerock.openbanking.common.error.exception.dynamicclientregistration.DynamicClientRegistrationException)3 RegistrationRequest (com.forgerock.openbanking.common.services.onboarding.registrationrequest.RegistrationRequest)3 Tpp (com.forgerock.openbanking.model.Tpp)3 IOException (java.io.IOException)3 ParseException (java.text.ParseException)3 ManualRegistrationRequest (com.forgerock.openbanking.common.model.onboarding.ManualRegistrationRequest)2 JWTClaimsSet (com.nimbusds.jwt.JWTClaimsSet)2 SignedJWT (com.nimbusds.jwt.SignedJWT)2 TppEntry (com.forgerock.openbanking.analytics.model.entries.TppEntry)1 MultiReadHttpServletRequest (com.forgerock.openbanking.aspsp.rs.filter.MultiReadHttpServletRequest)1 OpenBankingDirectoryConfiguration (com.forgerock.openbanking.common.services.onboarding.configuration.OpenBankingDirectoryConfiguration)1 DirectorySoftwareStatementFactory (com.forgerock.openbanking.common.services.onboarding.registrationrequest.DirectorySoftwareStatementFactory)1 OBErrorException (com.forgerock.openbanking.exceptions.OBErrorException)1 InvalidTokenException (com.forgerock.openbanking.jwt.exceptions.InvalidTokenException)1 OIDCRegistrationResponse (com.forgerock.openbanking.model.oidc.OIDCRegistrationResponse)1 ChangeSet (com.github.mongobee.changeset.ChangeSet)1 DateTime (org.joda.time.DateTime)1 Ignore (org.junit.Ignore)1