Package org.candlepin.auth

Examples of org.candlepin.auth.ConsumerPrincipal


        super(consumerCurator, deletedConsumerCurator, i18n);
    }

    public Principal getPrincipal(HttpRequest request) {

        ConsumerPrincipal principal = null;

        List<String> header = request.getHttpHeaders().getRequestHeader(
            CONSUMER_HEADER);
        String consumerUUID = null;
        if (null != header && header.size() > 0) {
View Full Code Here


        this.deletedConsumerCurator = deletedConsumerCurator;
        this.i18n = i18n;
    }

    public ConsumerPrincipal createPrincipal(String consumerUuid) {
        ConsumerPrincipal principal = null;

        if (consumerUuid != null) {
            // If this UUID has been deleted, return a 410.
            if (deletedConsumerCurator.countByConsumerUuid(consumerUuid) > 0) {
                log.debug("Key " + consumerUuid + " is deleted, throwing GoneException");
                throw new GoneException(
                    i18n.tr("Unit {0} has been deleted", consumerUuid), consumerUuid);
            }

            Consumer consumer = this.consumerCurator.getConsumer(consumerUuid);

            if (consumer != null) {
                principal = new ConsumerPrincipal(consumer);

                if (log.isDebugEnabled() && principal != null) {
                    log.debug("principal created for consumer '" +
                            principal.getConsumer().getUuid());
                }
            }
        }

        return principal;
View Full Code Here

TOP

Related Classes of org.candlepin.auth.ConsumerPrincipal

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.