Package org.rhq.enterprise.server.auth

Examples of org.rhq.enterprise.server.auth.SubjectManagerLocal


    }

    @Override
    public Configuration persistUpdatedPluginConfiguration(int resourceId, Configuration pluginConfiguration) {
        ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

        Subject overlord = subjectManager.getOverlord();
        PluginConfigurationUpdate update = configurationManager.upgradePluginConfiguration(overlord, resourceId,
            pluginConfiguration);

        return update.getResource().getPluginConfiguration();
    }
View Full Code Here


        criteria.setStrict(true);
        criteria.addFilterResourceIds(resourceId);
        criteria.addFilterName(driftDefName);

        DriftManagerLocal driftMgr = getDriftManager();
        SubjectManagerLocal subjectMgr = getSubjectManager();
        Subject overlord = subjectMgr.getOverlord();

        PageList<DriftDefinition> definitions = driftMgr.findDriftDefinitionsByCriteria(overlord, criteria);

        if (definitions.isEmpty()) {
            log.warn("Cannot update compliance for [resourceId: " + resourceId + ", driftDefinitionName: " +
View Full Code Here

     *
     * @throws Exception
     * @see    SubjectManagerLocal#loginUnauthenticated(String)
     */
    protected Subject getUserWithSession(Subject user, boolean reattach) throws Exception {
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        Subject subject = null;

        if (reattach && user.getSessionId() != null) {
            try {
                subject = subjectManager.getSubjectBySessionId(user.getSessionId());
            } catch (Exception e) {
                // session either doesn't exist or has timed out - fall thru to create a new session
            }
        }

        if (subject == null) {
            subject = subjectManager.loginUnauthenticated(user.getName());
            user.setSessionId(subject.getSessionId()); // we update the passed in object so the caller can use it as well

        }

        return subject;
View Full Code Here

            throw e;
        }
    }

    private PackageType ensurePackageTypeExists(PackageTypeDefinitionType def) throws InvalidPluginDescriptorException {
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        ContentManagerLocal cm = LookupUtil.getContentManager();

        PackageType packageType = cm.findPackageType(subjectManager.getOverlord(), null, def.getName());

        if (packageType == null) {
            //TODO support tying the package type to the resource types?
            packageType = new PackageType(def.getName(), null);
            packageType.setDescription(def.getDescription());
View Full Code Here

        Map<String, Boolean> userGlobalPermissionsMap = new HashMap<String, Boolean>();
        boolean needsRegistration = false;

        try {
            // authenticate the credentials
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            Subject subject = subjectManager.loginLocal(logonForm.getJ_username(), logonForm.getJ_password());
            Integer sessionId = subject.getSessionId(); // this is the RHQ session ID, not related to the HTTP session

            log.debug("Logged in as [" + logonForm.getJ_username() + "] with session id [" + sessionId + "]");

            boolean hasPrincipal = true;
            if (subject.getId() == 0) {
                // Subject with a ID of 0 means the subject wasn't in the database but the login succeeded.
                // This means the login method detected that LDAP authenticated the user and just gave us a dummy subject.
                // Set the needs-registration flag so we can eventually steer the user to the LDAP registration workflow.
                needsRegistration = true;
            }

            if (!needsRegistration) {
                subject = subjectManager.loadUserConfiguration(subject.getId());
                subject.setSessionId(sessionId); // put the transient data back into our new subject

                if (subject.getUserConfiguration() == null) {
                    subject.setUserConfiguration((Configuration) ctx.getAttribute(Constants.DEF_USER_PREFS));
                    subject = subjectManager.updateSubject(subject, subject);
                    subject.setSessionId(sessionId); // put the transient data back into our new subject
                }

                // look up the user's permissions
                Set<Permission> all_permissions = LookupUtil.getAuthorizationManager().getExplicitGlobalPermissions(
View Full Code Here

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        Log log = LogFactory.getLog(LogoutAction.class.getName());

        ServletContext ctx = getServlet().getServletContext();
        SubjectManagerLocal authBoss = LookupUtil.getSubjectManager();
        Integer sessionId = RequestUtils.getSessionId(request);
        authBoss.logout(sessionId.intValue());

        HttpSession session = request.getSession();

        clearSubjectPreferences(session);
View Full Code Here

                results.setError("No update performed. Failed to find server " + server.getName());
                return results;
            }

            if (serverAddr != null) {
                SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();

                server.setAddress(serverAddr);
                cloudMgr.updateServer(subjectMgr.getOverlord(), server);
            }

            int updateCount = notifyAgents(server);

            Configuration complexResults = results.getComplexResults();
View Full Code Here

        return numUpdated;
    }

    private void updateAgent(Resource agent, Server server) {
        OperationManagerLocal operationMgr = LookupUtil.getOperationManager();
        SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();

        Configuration params = new Configuration();
        params.put(new PropertySimple("server", server.getAddress()));

        ResourceOperationSchedule schedule = operationMgr.scheduleResourceOperation(subjectMgr.getOverlord(),
            agent.getId(), "switchToServer", 0, 0, 0, 0, params, "Cloud Plugin: syncing server endpoint address");

        if (log.isDebugEnabled()) {
            log.debug("Schedule address sync for agent [name: " + agent.getName() + "].");
            log.debug("Operation schedule is " + schedule);
View Full Code Here

        String userPassword = alertParameters.getSimpleValue(PROP_USER_PASSWORD, null);

        Integer userId = userIdString == null ? null : Integer.valueOf(userIdString);

        if (userId == null || userId != subject.getId()) {
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();

            Subject authSubject = subjectManager.checkAuthentication(userName, userPassword);

            if (authSubject == null) {
                PropertySimple userNameProp = new PropertySimple(PROP_USER_NAME, userName);
                userNameProp.setErrorMessage(VALIDATION_ERROR_MESSAGE);
                alertParameters.put(userNameProp);
View Full Code Here

        scriptTimeout = Integer.parseInt(timeoutValue);
    }

    public PackageType getScriptPackageType() {
        if (packageType == null) {
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            ContentManagerLocal cm = LookupUtil.getContentManager();
            packageType = cm.findPackageType(subjectManager.getOverlord(), null, PACKAGE_TYPE_NAME);
        }
        return packageType;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.auth.SubjectManagerLocal

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.