org.wso2.carbon.user.api.Properties Java Examples

The following examples show how to use org.wso2.carbon.user.api.Properties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerUserStoreService.java    From identity-api-server with Apache License 2.0 6 votes vote down vote up
/**
 * Construct the user store type's meta.
 *
 * @param typeId        the type id of the user store.
 * @return MetaUserStoreType.
 */
private MetaUserStoreType buildUserStoreMetaResponse(String typeId) {

    String typeName = base64URLDecodeId(typeId);
    Properties properties = UserStoreManagerRegistry.getUserStoreProperties(
            getUserStoreType(typeName));
    MetaUserStoreType metaUserStore = new MetaUserStoreType();
    UserStorePropertiesRes userStorePropertiesRes = new UserStorePropertiesRes();
    if ((properties != null)) {
        userStorePropertiesRes.mandatory(buildPropertiesRes(properties.getMandatoryProperties()));
        userStorePropertiesRes.optional(buildPropertiesRes(properties.getOptionalProperties()));
        userStorePropertiesRes.advanced(buildPropertiesRes(properties.getAdvancedProperties()));
    }
    metaUserStore.setProperties(userStorePropertiesRes);
    metaUserStore.setTypeId(typeId);
    metaUserStore.setTypeName(typeName);
    metaUserStore.setClassName(getUserStoreType(typeName));

    return metaUserStore;
}
 
Example #2
Source File: UserStoreConfigAdminService.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Get User Store Manager default properties for a given implementation
 *
 * @param className Implementation class name for the user store
 * @return list of default properties(mandatory+optional)
 */
public Properties getUserStoreManagerProperties(String className) throws IdentityUserStoreMgtException {
    Properties properties = UserStoreManagerRegistry.getUserStoreProperties(className);

    if (properties != null && properties.getOptionalProperties() != null) {

        Property[] optionalProperties = properties.getOptionalProperties();
        boolean foundUniqueIDProperty = false;
        for (Property property : optionalProperties) {
            if (UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT.equals(property.getName())) {
                foundUniqueIDProperty = true;
                break;
            }
        }
        if (!foundUniqueIDProperty) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Inserting property : " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT +
                          " since " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT +
                          " property not defined as an optional property in " + className + " class");
            }
            List<Property> optionalPropertyList = new ArrayList<>(Arrays.asList(optionalProperties));
            Property uniqueIDProperty = new Property(
                    UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT, "", "", null);
            optionalPropertyList.add(uniqueIDProperty);

            properties.setOptionalProperties(
                    optionalPropertyList.toArray(new Property[optionalPropertyList.size()]));
        }
    }

    return properties;
}
 
Example #3
Source File: UserStoreConfigAdminService.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Get User Store Manager default properties for a given implementation
 *
 * @param className:Implementation class name for the user store
 * @return : list of default properties(mandatory+optional)
 */
public Properties getUserStoreManagerProperties(String className) throws IdentityUserStoreMgtException {
    Properties properties = UserStoreManagerRegistry.getUserStoreProperties(className);

    if (properties != null && properties.getOptionalProperties() != null) {

        Property[] optionalProperties =  properties.getOptionalProperties();

        boolean foundUniqueIDProperty = false;
        for (Property property : optionalProperties) {
            if (UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT.equals(property.getName())) {
                foundUniqueIDProperty = true;
                break;
            }
        }
        if (!foundUniqueIDProperty) {
            if (log.isDebugEnabled()) {
                log.debug("Inserting property : " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT +
                        " since " + UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT +
                        " property not defined as an optional property in " + className + " class");
            }
            List<Property> optionalPropertyList = new ArrayList<>(Arrays.asList(optionalProperties));
            Property uniqueIDProperty = new Property(
                    UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT, "", "", null);
            optionalPropertyList.add(uniqueIDProperty);

            properties.setOptionalProperties(
                    optionalPropertyList.toArray(new Property[optionalPropertyList.size()]));
        }
    }

    return properties;
}
 
Example #4
Source File: MockUserStoreManager.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
@Override
public Properties getDefaultUserStoreProperties() {
    return null;
}
 
Example #5
Source File: CarbonRemoteUserStoreManger.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
/**
 *
 */

@Override
public Properties getDefaultUserStoreProperties() {
    Properties properties = new Properties();
    Property[] mandatoryProperties = null;
    Property[] optionalProperties = null;
    Property remoteServerUserName = new Property(
            REMOTE_USER_NAME,
            "",
            "Remote Sever Username#Name of a user from the remote server, having enough privileges for user management",
            null);
    Property password = new Property(PASSWORD, "",
            "Remote Server Password#The password correspoing to the remote server " +
                    "username#encrypt",
            null);
    Property serverUrls = new Property(
            SERVER_URLS,
            "",
            "Remote Server URL(s)#Remote server URLs. e.g.: https://ca-datacenter/services,https://va-datacenter/services",
            null);
    Property disabled = new Property("Disabled", "false", "Disabled#Check to disable the user store", null);

    Property passwordJavaScriptRegEx = new Property(
            UserStoreConfigConstants.passwordJavaScriptRegEx, "^[\\S]{5,30}$",
            "Password RegEx (Javascript)#"
                    + UserStoreConfigConstants.passwordJavaScriptRegExDescription, null);
    Property usernameJavaScriptRegEx = new Property(
            UserStoreConfigConstants.usernameJavaScriptRegEx, "^[\\S]{3,30}$",
            "Username RegEx (Javascript)#"
                    + UserStoreConfigConstants.usernameJavaRegExDescription, null);
    Property roleNameJavaScriptRegEx = new Property(
            UserStoreConfigConstants.roleNameJavaScriptRegEx, "^[\\S]{3,30}$",
            "Role Name RegEx (Javascript)#"
                    + UserStoreConfigConstants.roleNameJavaScriptRegExDescription, null);

    mandatoryProperties = new Property[] {remoteServerUserName, password, serverUrls, passwordJavaScriptRegEx,
            usernameJavaScriptRegEx, roleNameJavaScriptRegEx};
    optionalProperties = new Property[] {disabled};

    properties.setOptionalProperties(optionalProperties);
    properties.setMandatoryProperties(mandatoryProperties);
    return properties;
}
 
Example #6
Source File: CassandraUserStoreManager.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
@Override
public org.wso2.carbon.user.api.Properties getDefaultUserStoreProperties() {

    return new Properties();
}
 
Example #7
Source File: WSUserStoreManager.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
@Override
public Properties getDefaultUserStoreProperties() {
    return null;
}