Package org.rhq.core.domain.auth

Examples of org.rhq.core.domain.auth.Subject


        resource.setInventoryStatus(InventoryStatus.COMMITTED);
        return resource;
    }

    protected Resource getResource(ResourceCriteria resourceCriteria) {
        Subject overlord = getOverlord();

        PageList<Resource> results = resourceManager.findResourcesByCriteria(overlord, resourceCriteria);
        if (results.size() == 0) {
            return null;
        } else if (results.size() == 1) {
View Full Code Here


    protected void cleanupResourceType(String rtName) throws Exception {
        try {
            ResourceType rt = getResourceType(rtName);

            if (null != rt) {
                Subject overlord = getOverlord();
                ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

                // delete any resources first
                ResourceCriteria c = new ResourceCriteria();
                c.setStrict(true);
View Full Code Here

            return isAuthorized.booleanValue();
        }

        // kick off the async auth check. return false initially and update when the async call returns
        RoleCriteria criteria = new RoleCriteria();
        Subject subject = UserSessionManager.getSessionSubject();
        criteria.addFilterSubjectId(subject.getId());
        criteria.addFilterPermissions(permissions);
        GWTServiceLookup.getRoleService().findRolesByCriteria(criteria, new AsyncCallback<PageList<Role>>() {
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError("", caught);
            }
View Full Code Here

        boolean continueProcessing = true;
        String sid = req.getHeader("RHQ_Session");
        if (sid != null) {
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            try {
                Subject subject = subjectManager.getSubjectBySessionId(Integer.parseInt(sid));
                sessionSubject.set(subject);
            } catch (Exception e) {
                log.trace("Failed to validate request: sessionId was '" + sid + "', requestURL=" + req.getRequestURL());
                continueProcessing = false;
            }
View Full Code Here

     * @throws Exception from method call or if no (valid) principal was provided
     */
    @AroundInvoke
    public Object setCaller(InvocationContext ctx) throws Exception {

        Subject caller=null;
        java.security.Principal p = ejbContext.getCallerPrincipal();
        if (p!=null) {
            caller = subjectManager.getSubjectByName(p.getName());
        }

        if (caller==null) {
            throw new IllegalAccessException("No calling principal provided");
        }

        // Get Subject with a session
        caller = sessionManager.put(caller);

        // Provide it to the EJB
        AbstractRestBean target = (AbstractRestBean) ctx.getTarget();
        target.caller = caller;

        // Call the EJBs
        Object result =  ctx.proceed();

        // if result is StreamingOutput, we do not want to invalidate the session until it
        // is finished writing the output; otherwise, any secure SLSB calls will fail. We
        // instead wrap the result in an instance of SecureStreamingOutput which
        // invalidates the session after the output has been written.
        if (result instanceof StreamingOutput) {
            return new SecureStreamingOutput((StreamingOutput) result, caller);
        }

        // Invalidate the session again.
        sessionManager.invalidate(caller.getSessionId());

        return result;
    }
View Full Code Here

    }

    @Test(enabled = ENABLE_TESTS)
    public void testSuccessfulDeployPackages() throws Exception {
        // Setup  --------------------------------------------
        Subject overlord = subjectManager.getOverlord();

        Set<ResourcePackageDetails> installUs = new HashSet<ResourcePackageDetails>(2);

        // Package 1, Version 2 with configuration values
        PackageVersion packageVersion1 = package1.getVersions().get(0);
View Full Code Here

    }

    @Test(enabled = ENABLE_TESTS)
    public void testDeployWithSteps() throws Exception {
        // Setup  --------------------------------------------
        Subject overlord = subjectManager.getOverlord();

        Set<ResourcePackageDetails> installUs = new HashSet<ResourcePackageDetails>(2);

        // Package 1, Version 2 with configuration values
        PackageVersion packageVersion1 = package1.getVersions().get(0);
View Full Code Here

    }

    @Test(enabled = ENABLE_TESTS)
    public void testFailedDeployPackages() throws Exception {
        // Setup  --------------------------------------------
        Subject overlord = subjectManager.getOverlord();

        Set<ResourcePackageDetails> installUs = new HashSet<ResourcePackageDetails>(1);

        // Package 1, Version 2 with configuration values
        Configuration deploymentConfiguration1 = new Configuration();
View Full Code Here

    }

    @Test(enabled = ENABLE_TESTS)
    public void testDeployPackageFailToContactAgent() throws Exception {
        // Setup  --------------------------------------------
        Subject overlord = subjectManager.getOverlord();

        Set<ResourcePackageDetails> installUs = new HashSet<ResourcePackageDetails>(1);

        // Package 1, Version 2 with configuration values
        Configuration deploymentConfiguration1 = new Configuration();
View Full Code Here

    }

    @Test(enabled = ENABLE_TESTS)
    public void testDeployPackagesNoIndividualResponses() throws Exception {
        // Setup  --------------------------------------------
        Subject overlord = subjectManager.getOverlord();

        Set<ResourcePackageDetails> installUs = new HashSet<ResourcePackageDetails>(1);

        // Package 1, Version 2 with configuration values
        Configuration deploymentConfiguration1 = new Configuration();
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.auth.Subject

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.