Package org.rhq.core.domain.auth

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


        getTransactionManager().begin();
        try {
            EntityManager em = getEntityManager();

            // setup simple test structures
            Subject subject = SessionTestHelper.createNewSubject(em, "subject-ClusterManagerBeanTest");
            Role role = SessionTestHelper.createNewRoleForSubject(em, subject, "role-ClusterManagerBeanTest",
                Permission.MANAGE_INVENTORY);

            ResourceGroup clusterGroup = SessionTestHelper.createNewCompatibleGroupForRole(em, role,
                "clusterGroup-ClusterManagerBeanTest");
View Full Code Here


        afterClassWork();
    }

    @Test
    public void testScheduleUpdateOnAgents() throws Exception {
        Subject overlord = subjectMgr.getOverlord();
        pluginMgr.schedulePluginUpdateOnAgents(overlord, 0);
        pluginUpdateProgressWaiter.await();
        Assert.assertTrue(updatePluginsCalled);
    }
View Full Code Here

    @Test
    public void testUpdateNotDoneUntilAgentReturns() throws Exception {
        pluginUpdateFinishWaiter = new CountDownLatch(1);

        Subject overlord = subjectMgr.getOverlord();
        String handle = pluginMgr.schedulePluginUpdateOnAgents(overlord, 0);

        pluginUpdateProgressWaiter.await();

        boolean finished = pluginMgr.isPluginUpdateOnAgentsFinished(subjectMgr.getOverlord(), handle);
View Full Code Here

    private MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
        .getMeasurementDefinitionManager();

    @Override
    protected void init() throws Exception {
        Subject subject = EnterpriseFacesContextUtility.getSubject();

        String parentIdString = FacesContextUtility.getOptionalRequestParameter("contextParentResourceId");
        String resourceTypeIdString = FacesContextUtility.getOptionalRequestParameter("contextAutoGroupResourceTypeId");

        if (parentIdString != null && resourceTypeIdString != null) {
View Full Code Here

        // First wait to give Hibernate a chance to close all transactions etc.
        try {
            Thread.sleep(2000L);
        } catch (InterruptedException ignored) {
        }
        Subject superuser = LookupUtil.getSubjectManager().getOverlord();
        SystemManagerLocal systemManager = LookupUtil.getSystemManager();
        systemManager.vacuum(superuser, new String[] { "RHQ_MEASUREMENT_DEF", "RHQ_CONFIG_DEF", "RHQ_RESOURCE_TYPE",
            "RHQ_RESOURCE_TYPE_PARENTS", Plugin.TABLE_NAME });

        return;
View Full Code Here

    private MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
        .getMeasurementDefinitionManager();

    @Override
    protected void init() throws Exception {
        Subject subject = EnterpriseFacesContextUtility.getSubject();

        String clusterKeyString = FacesContextUtility.getOptionalRequestParameter("contextClusterKey");
        String groupIdString = FacesContextUtility.getOptionalRequestParameter("contextGroupId");
        currentParentResourceGroupId = FacesContextUtility.getOptionalRequestParameter("contextParentGroupId");
View Full Code Here

            key = new Integer(_random.nextInt());
        } while (_cache.containsKey(key));

        // Each session should have its own POJO Subject so that each can store a separate sessionId. The exception
        // is our special-case shared singleton for overlord.
        Subject sessionSubject;
        if (subject.equals(overlordSubject)) {
            sessionSubject = overlordSubject;
            sessionSubject.setSessionId(key);

        } else {
            sessionSubject = getSessionSubject(subject, key);
        }
View Full Code Here

        // we currently use a shared session for overlord.  don't log it out as it could affect another caller's use
        // of the overlord user.  The session will expire if unused by any caller for the overlord timeout period.
        AuthSession session = _cache.get(sessionIdObj);
        if (session != null) {
            Subject doomedSubject = session.getSubject(false);
            if (doomedSubject.getId() == OVERLORD_SUBJECT_ID) {
                return;
            }
        }

        _cache.remove(sessionIdObj);
View Full Code Here

            session_id = put(overlordSubject, OVERLORD_TIMEOUT).getSessionId();
            overlordSubject.setSessionId(session_id);
        }

        // we create a separate and detached Subject for each caller - do not share the copy this singleton holds internally
        Subject copy = getSessionSubject(overlordSubject, session_id);
        return copy;
    }
View Full Code Here

        Subject copy = getSessionSubject(overlordSubject, session_id);
        return copy;
    }

    private Subject getSessionSubject(Subject subject, Integer sessionId) {
        Subject copy = new Subject(subject.getName(), subject.getFactive(), subject.getFsystem());
        copy.setId(subject.getId());
        copy.setSessionId(sessionId);

        copy.setDepartment(subject.getDepartment());
        copy.setEmailAddress(subject.getEmailAddress());
        copy.setFirstName(subject.getFirstName());
        copy.setLastName(subject.getLastName());
        copy.setLdapRoles(subject.getLdapRoles());
        copy.setOwnedGroups(subject.getOwnedGroups());
        copy.setPhoneNumber(subject.getPhoneNumber());
        copy.setRoles(subject.getRoles());
        copy.setUserConfiguration(subject.getUserConfiguration());

        return copy;
    }
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.