class SystemApiController implements SystemApi {

    @Override
    @PreAuthorize("hasAuthority('GENERATE_INTERNAL_TLS_CSR')")
    @AuditEventMethod(event = GENERATE_INTERNAL_TLS_CSR)
    public ResponseEntity<Resource> generateSystemCertificateRequest(DistinguishedName distinguishedName) {
        byte[] csrBytes = null;
        try {
            csrBytes = systemService.generateInternalCsr(distinguishedName.getName());
        } catch (InvalidDistinguishedNameException e) {
            throw new BadRequestException(e);
        }
        return ApiUtil.createAttachmentResourceResponse(csrBytes, csrFilenameCreator.createInternalCsrFilename());
    }

    @Autowired public  SystemApiController(InternalTlsCertificateService internalTlsCertificateService,
            CertificateDetailsConverter certificateDetailsConverter, SystemService systemService,
            TimestampingServiceConverter timestampingServiceConverter, AnchorConverter anchorConverter,
            VersionService versionService, VersionConverter versionConverter, CsrFilenameCreator csrFilenameCreator,
            AuditDataHelper auditDataHelper);

}