Examples of AttributeDefinition


Examples of com.adito.properties.attributes.AttributeDefinition

    @Test
    public void updateSystemUserAttributeDefinitionName() throws Exception {
        User user = createAccount();
        UserAttributes attribute = new UserAttributes();
        UserAttributeKey attributeKey = new UserAttributeKey(user, "fathersFirstName");
        AttributeDefinition attributeDefinition = (AttributeDefinition)attribute.getDefinition(attributeKey.getName());
        try {
            updateAttributeDefinition(attribute, attributeDefinition);
            fail("This should have failed");
        } catch (Exception e) {
            // ignore
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

        // Read in all of the confidential user attribute values
        Properties confidentialAttributes = new Properties();
        UserAttributes userAttributes = (UserAttributes) PropertyClassManager.getInstance().getPropertyClass(UserAttributes.NAME);
        for (PropertyDefinition def : userAttributes.getDefinitions()) {
            AttributeDefinition attrDef = (AttributeDefinition) def;
            if (attrDef.getVisibility() == AttributeDefinition.USER_CONFIDENTIAL_ATTRIBUTE) {
                confidentialAttributes.setProperty(def.getName(), attrDef.getPropertyClass()
                                .retrieveProperty(new UserAttributeKey(info.getUser(), def.getName())));
            }
        }

        try {

            // Change the password

            udb.changePassword(user.getPrincipalName(), f.getOldPassword(), f.getNewPassword(), false);
           
            PublicKeyStore publicKeyStore = PublicKeyStore.getInstance();
            if ("automatic".equals(Property.getProperty(new SystemConfigKey("security.privateKeyMode")))) { 
                if (publicKeyStore.isPassphraseValid(user.getPrincipalName(), f.getOldPassword())) {
                    publicKeyStore.changePrivateKeyPassphrase(user.getPrincipalName(), f.getOldPassword(), f.getNewPassword());
                    publicKeyStore.removeCachedKeys(user.getPrincipalName());
                    publicKeyStore.verifyPrivateKey(user.getPrincipalName(), f.getNewPassword().toCharArray());

                    // Write back all of the confidential user attribute values
                    for (PropertyDefinition def : userAttributes.getDefinitions()) {
                        AttributeDefinition attrDef = (AttributeDefinition) def;
                        if (attrDef.getVisibility() == AttributeDefinition.USER_CONFIDENTIAL_ATTRIBUTE) {
                            Property.setProperty(new UserAttributeKey(info.getUser(), def.getName()), confidentialAttributes
                                            .getProperty(def.getName()), info);
                        }
                    }
                } else {
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

                f.setReferer(CoreUtil.getReferer(request));
            }
        }
        List<PersonalAnswer> personalAnswers = new ArrayList<PersonalAnswer>();
        User user = LogonControllerFactory.getInstance().getUser(request);
        AttributeDefinition def;
        for (int i = 0; i < PersonalQuestionsAuthenticationModule.SECURITY_QUESTIONS.length; i++) {
         
            String id = PersonalQuestionsAuthenticationModule.SECURITY_QUESTIONS[i];
            def = (AttributeDefinition)PropertyClassManager.getInstance().getPropertyClass(UserAttributes.NAME).getDefinition(id);
            String answer = Property.getProperty(new UserAttributeKey(user, def.getName()));
            personalAnswers.add(new PersonalAnswer(id, answer==null ? "" : answer, def.getLabel()));
        }
       
        f.initialize(personalAnswers);
        if (request.getSession().getAttribute(Constants.REQ_ATTR_PERSONAL_ANSWERS_CHANGE_REASON_MESSAGE) != null) {
            ActionMessages messages = new ActionMessages();
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

  @Override
  public String processReplacementVariable(Pattern pattern, Matcher matcher, String replacementPattern, String type, String key) throws Exception {
    if (type.equalsIgnoreCase("attr") || type.equals("userAttributes")) {
            PropertyClass propertyClass = PropertyClassManager.getInstance().getPropertyClass(UserAttributes.NAME);
            AttributeDefinition def = (AttributeDefinition) propertyClass.getDefinition(key);
            if (def == null) {
                VariableReplacement.log.warn("Invalid user attribute '" + key + "'");
                return null;
            } else {
                String val = Property.getProperty(new UserAttributeKey(username, key, realm));
                if(val.equals("")) {
                  val = def.getDefaultValue();
                }
                return val;
            }
        }
    return null;
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

  @Override
  public String processReplacementVariable(Pattern pattern, Matcher matcher, String replacementPattern, String type, String key) throws Exception {
    if (type.equalsIgnoreCase(PolicyAttributes.NAME)) {
            PropertyClass propertyClass = PropertyClassManager.getInstance().getPropertyClass(type);
            AttributeDefinition def = (AttributeDefinition) propertyClass.getDefinition(key);
            if (def == null) {
                VariableReplacement.log.warn("Invalid policy attribute '" + key + "'");
                return null;
            } else {
                return Property.getProperty(new PolicyAttributeKey(policy.getResourceId(), key));
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

         * objects
         */

        attributeValueItems = new ArrayList();
        for (PropertyDefinition d : propertyClass.getDefinitions()) {
            AttributeDefinition def = (AttributeDefinition) d;
            if (!def.isHidden()) {
                if (def.getVisibility() != AttributeDefinition.USER_CONFIDENTIAL_ATTRIBUTE) {
                    String value = def.getDefaultValue();
                    if (user != null) {
                        value = Property.getProperty(new PolicyAttributeKey(getResourceId(), def.getName()));
                    }
                    AttributeValueItem item = new AttributeValueItem(def, request, value);
                    attributeValueItems.add(item);
                }
            }
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

        } else if (type.equalsIgnoreCase("attr") || type.equals(UserAttributes.NAME)) {
            if (sessionInfo == null) {
                return null;
            }
            PropertyClass propertyClass = PropertyClassManager.getInstance().getPropertyClass(UserAttributes.NAME);
            AttributeDefinition def = (AttributeDefinition) propertyClass.getDefinition(key);
            if (def == null) {
                VariableReplacement.log.warn("Invalid user attribute '" + key + "'");
                return null;
            } else {
                return Property.getProperty(new UserAttributeKey(sessionInfo.getUser(), key));
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

        this.owner = owner;
        this.user = LogonControllerFactory.getInstance().getUser(request);
        this.assignOnly = assignOnly;
        userAttributeValueItems = new ArrayList<AttributeValueItem>();
        for (PropertyDefinition d : propertyClass.getDefinitions()) {
            AttributeDefinition def = new DefaultAttributeDefinition(d.getType(), d.getName(), d.getTypeMeta(), d.getCategory(), "", d
                            .getDefaultValue(), AttributeDefinition.UNKNOWN, 10, d.getMessageResourcesKey(), false, d.getLabel(), d.getDescription(), false, false, "");
            def.init(propertyClass);
           if (!def.isHidden() && isResourcePropertyDefinition(resource, d)) {
                    String value = def.getDefaultValue();
                    if (resource != null) {
                        value = Property.getProperty(new ResourceKey(def.getName(), resource.getResourceType(), resource.getResourceId()));
                    }
                    AttributeValueItem item = new AttributeValueItem(def, request, value, getSubCategoryString(resource));
                    userAttributeValueItems.add(item);
            }
        }
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

                try {
                    // If there is a default value then validate it
                   
                    String defaultValue = getDefaultValue().trim();
                    if(!defaultValue.equals("")) {
                      AttributeDefinition def = getAttributesClass().createAttributeDefinition(type,
                            (String)getWizardSequence().getAttribute(AttributeDefinitionDetailsAction.ATTR_NAME, null),
                            typeMeta,
                            -1,
                            category,
                            defaultValue,
                            visibility,
                            sortOrder,
                            null,
                            false,
                            label,
                            (String)getWizardSequence().getAttribute(AttributeDefinitionDetailsAction.ATTR_DESCRIPTION, null),
                            false,
                            true,
                            validationString);
                        try {
                          def.validate(defaultValue, getClass().getClassLoader());
                        } catch (CoreException ce) {
                            ce.getBundleActionMessage().setArg3(def.getLabel());
                            if (errs == null) {
                                errs = new ActionErrors();
                            }
                            errs.add(Globals.ERROR_KEY, ce.getBundleActionMessage());
                        }
View Full Code Here

Examples of com.adito.properties.attributes.AttributeDefinition

     *
     * @see com.adito.properties.PropertyDatabase#deleteAttributeDefinition(java.lang.String,
     *      java.lang.String)
     */
    public void deleteAttributeDefinition(String propertyClassName, String definitionName) throws Exception {
        AttributeDefinition def = (AttributeDefinition) PropertyClassManager.getInstance()
                        .getPropertyClass(propertyClassName)
                        .getDefinition(definitionName);
        if (def == null) {
            throw new Exception("Definition with name " + definitionName + " cannot be deleted as it does not exist.");
        }
        if (def.isSystem()) {
            throw new Exception("Definition with name " + definitionName + " cannot be deleted as it is a system definition.");
        }
        JDBCPreparedStatement ps = db.getStatement("deleteAttributeDefinition.delete");
        try {
            ps.setString(1, propertyClassName);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.