Package org.candlepin.model

Examples of org.candlepin.model.IdentityCertificate


        if (updated.getName() != null && !toUpdate.getName().equals(updated.getName())) {
            checkConsumerName(updated);
            toUpdate.setName(updated.getName());

            // get the new name into the id cert
            IdentityCertificate ic = generateIdCert(toUpdate, true);
            toUpdate.setIdCert(ic);
        }

        if (updated.getLastCheckin() != null) {
            toUpdate.setLastCheckin(updated.getLastCheckin());
View Full Code Here


        Consumer c = consumerCurator.verifyAndLookupConsumer(uuid);
        EventBuilder eventBuilder = eventFactory
                .getEventBuilder(Target.CONSUMER, Type.MODIFIED)
                .setOldEntity(c);

        IdentityCertificate ic = generateIdCert(c, true);
        c.setIdCert(ic);
        consumerCurator.update(c);
        sink.queueEvent(eventBuilder.setNewEntity(c).buildEvent());
        return c;
    }
View Full Code Here

     * @param c Consumer whose certificate needs to be generated.
     * @param regen if true, forces a regen of the certificate.
     * @return an IdentityCertificate object
     */
    private IdentityCertificate generateIdCert(Consumer c, boolean regen) {
        IdentityCertificate idCert = null;
        boolean errored = false;

        try {
            if (regen) {
                idCert = identityCertService.regenerateIdentityCert(c);
            }
            else {
                idCert = identityCertService.generateIdentityCert(c);
            }

            if (idCert == null) {
                errored = true;
            }
        }
        catch (GeneralSecurityException e) {
            log.error("Problem regenerating ID cert for unit:", e);
            errored = true;
        }
        catch (IOException e) {
            log.error("Problem regenerating ID cert for unit:", e);
            errored = true;
        }

        if (errored) {
            throw new BadRequestException(i18n.tr(
                "Problem regenerating ID cert for unit {0}", c));
        }

        log.debug("Generated identity cert: {}", idCert.getSerial());

        return idCert;
    }
View Full Code Here

    public ConsumerDto importConsumer(Owner owner, File consumerFile,
        File[] upstreamConsumer, ConflictOverrides forcedConflicts, Meta meta)
        throws IOException, SyncDataFormatException {

        IdentityCertificate idcert = null;
        for (File uc : upstreamConsumer) {
            if (uc.getName().endsWith(".json")) {
                log.debug("Import upstream consumeridentity certificate: " +
                    uc.getName());
                Reader reader = null;
View Full Code Here

        throws IOException {

        File idcertdir = new File(baseDir.getCanonicalPath(), "upstream_consumer");
        idcertdir.mkdir();

        IdentityCertificate cert = consumer.getIdCert();
        File file = new File(idcertdir.getCanonicalPath(),
            cert.getSerial().getId() + ".json");

        // paradigm dictates this should go in an exporter.export method
        FileWriter writer = null;

        try {
View Full Code Here

TOP

Related Classes of org.candlepin.model.IdentityCertificate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.