Search in sources :

Example 1 with ResourceLocationDto

use of uk.gov.ida.hub.config.dto.ResourceLocationDto in project verify-hub by alphagov.

the class TransactionsResource method getAssertionConsumerServiceUri.

@GET
@Path(Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_URI_PATH)
@Timed
public ResourceLocationDto getAssertionConsumerServiceUri(@PathParam(Urls.SharedUrls.ENTITY_ID_PARAM) String entityId, @QueryParam(Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_INDEX_PARAM) Optional<Integer> assertionConsumerServiceIndex) {
    final TransactionConfigEntityData configData = getTransactionConfigData(entityId);
    final Optional<URI> assertionConsumerServiceUri = configData.getAssertionConsumerServiceUri(assertionConsumerServiceIndex);
    if (!assertionConsumerServiceUri.isPresent()) {
        // we know that the index must be here because we will have pre-validated that there will be a default for the transaction
        throw exceptionFactory.createInvalidAssertionConsumerServiceIndexException(entityId, assertionConsumerServiceIndex.get());
    }
    return new ResourceLocationDto(assertionConsumerServiceUri.get());
}
Also used : TransactionConfigEntityData(uk.gov.ida.hub.config.domain.TransactionConfigEntityData) URI(java.net.URI) ResourceLocationDto(uk.gov.ida.hub.config.dto.ResourceLocationDto) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 TransactionConfigEntityData (uk.gov.ida.hub.config.domain.TransactionConfigEntityData)1 ResourceLocationDto (uk.gov.ida.hub.config.dto.ResourceLocationDto)1