Package org.candlepin.auth

Examples of org.candlepin.auth.Principal


    }

    protected Principal establishPrincipal(HttpRequest request, ResourceMethod method,
        SecurityHole securityHole) {

        Principal principal = null;

        if (log.isDebugEnabled()) {
            log.debug("Authentication check for " + request.getUri().getPath());
        }
View Full Code Here


    @Override
    public void onEvent(Event event) {
        // We're outside of a web request here, need to create this event and satisfy the
        // access control interceptor.
        Principal systemPrincipal = new SystemPrincipal();
        ResteasyProviderFactory.pushContext(Principal.class, systemPrincipal);
        if (log.isDebugEnabled()) {
            log.debug("Received event: " + event);
        }
View Full Code Here

     * hiding the results from the other.
     *
     * @return Criteria Final criteria query with all filters applied.
     */
    protected Criteria createSecureCriteria() {
        Principal principal = principalProvider.get();
        Criteria query = currentSession().createCriteria(entityType);

        /*
         * There are situations where consumer queries are run before there is a principal,
         * i.e. during authentication when we're looking up the consumer itself.
         */
        if (principal == null) {
            return query;
        }


        // Admins do not need query filtering enabled.
        if (principal.hasFullAccess()) {
            return query;
        }

        Criterion finalCriterion = null;
        for (Permission perm : principal.getPermissions()) {

            Criterion crit = perm.getCriteriaRestrictions(entityType);
            if (crit != null) {
                log.debug("Got criteria restrictions from permissions {} for {}: {}",
                    new Object [] {perm, entityType, crit});
View Full Code Here

        if (user.isSuperAdmin()) {
            return new UserPrincipal(username, null, true);
        }
        else {
            Principal principal = new UserPrincipal(username, user.getPermissions(), false);

            return principal;
        }
    }
View Full Code Here

     * Attempt to pull a principal off of an oauth signed message.
     *
     * @return the principal if it can be created, nil otherwise
     */
    public Principal getPrincipal(HttpRequest request) {
        Principal principal = null;

        try {
            if (AuthUtil.getHeader(request, "Authorization").contains("oauth")) {
                OAuthMessage requestMessage = new RestEasyOAuthMessage(request);
                OAuthAccessor accessor = this.getAccessor(requestMessage);
View Full Code Here

TOP

Related Classes of org.candlepin.auth.Principal

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.