コード例 #1
0
  public Directory buildDelegatingLdapDirectory(
      DelegatingLdapDirectoryConfiguration configuration) {
    ImmutableDirectory.Builder builder = createBuilder();
    builder.setAllowedOperations(EnumSet.allOf(OperationType.class));
    builder.setActive(configuration.isActive());
    builder.setId(configuration.getDirectoryId());
    builder.setImplementationClass(DelegatedAuthenticationDirectory.class.getName());
    builder.setName(configuration.getName());
    builder.setType(DirectoryType.DELEGATING);

    LdapDelegatingDirectoryAttributes attributes = new LdapDelegatingDirectoryAttributes();
    BeanUtils.copyProperties(
        configuration, attributes); // ignores attributes that don't exist in the target - perfect!
    attributes.setDelegatedToClass(configuration.getType());
    if (configuration.isCreateUserOnAuth()) {
      attributes.setUpdateUserOnAuth(true); // create-on-auth implies update-on-auth
      attributes.setLdapAutoAddGroups(
          commaWhitespaceSeparatedGroupsToPipeSeparatedGroups(
              configuration.getLdapAutoAddGroups()));
    } else {
      attributes.setLdapAutoAddGroups("");
    }
    builder.setAttributes(attributes.toAttributesMap());

    return builder.toDirectory();
  }
コード例 #2
0
  public Directory buildLdapDirectory(LdapDirectoryConfiguration configuration) {
    ImmutableDirectory.Builder builder = createBuilder();
    builder.setActive(configuration.isActive());
    builder.setAllowedOperations(configuration.getLdapPermissionOption().getAllowedOperations());
    builder.setEncryptionType(configuration.getLdapUserEncryption());
    builder.setId(configuration.getDirectoryId());
    builder.setImplementationClass(configuration.getType());
    builder.setName(configuration.getName());
    builder.setType(DirectoryType.CONNECTOR);

    LdapDirectoryAttributes attributes = new LdapDirectoryAttributes();
    BeanUtils.copyProperties(
        configuration, attributes); // ignores attributes that don't exist in the target - perfect!
    attributes.setIncrementalSyncEnabled(configuration.isCrowdSyncIncrementalEnabled());
    if (configuration.getLdapPermissionOption() == PermissionOption.READ_ONLY_LOCAL_GROUPS) {
      attributes.setLdapAutoAddGroups(
          commaWhitespaceSeparatedGroupsToPipeSeparatedGroups(
              configuration.getLdapAutoAddGroups()));
    } else {
      attributes.setLdapAutoAddGroups("");
    }
    builder.setAttributes(attributes.toAttributesMap());

    return builder.toDirectory();
  }
コード例 #3
0
  public Directory buildJiraJdbcDirectory(JiraJdbcDirectoryConfiguration configuration) {
    ImmutableDirectory.Builder builder = createBuilder();
    builder.setAllowedOperations(EnumSet.of(OperationType.UPDATE_USER));
    builder.setActive(configuration.isActive());
    builder.setId(configuration.getDirectoryId());
    builder.setImplementationClass(JiraJdbcDirectoryConfiguration.DIRECTORY_CLASS);
    builder.setName(configuration.getName());
    builder.setType(DirectoryType.CUSTOM);

    builder.setAttributes(
        Collections.singletonMap(
            JiraJdbcDirectoryConfiguration.JNDI_NAME_ATTRIBUTE_KEY,
            configuration.getDatasourceJndiName()));

    return builder.toDirectory();
  }
コード例 #4
0
  public Directory buildCrowdDirectory(CrowdDirectoryConfiguration configuration) {
    ImmutableDirectory.Builder builder = createBuilder();
    builder.setAllowedOperations(configuration.getCrowdPermissionOption().getAllowedOperations());
    builder.setActive(configuration.isActive());
    builder.setId(configuration.getDirectoryId());
    builder.setImplementationClass(RemoteCrowdDirectory.class.getName());
    builder.setName(configuration.getName());
    builder.setType(DirectoryType.CROWD);

    CrowdDirectoryAttributes attributes = new CrowdDirectoryAttributes();
    BeanUtils.copyProperties(
        configuration, attributes); // ignores attributes that don't exist in the target - perfect!
    // Convert polling interval from minutes to seconds to store in crowd
    attributes.setCrowdServerSynchroniseIntervalInSeconds(
        Long.toString(configuration.getCrowdServerSynchroniseIntervalInMin() * 60));
    builder.setAttributes(attributes.toAttributesMap());

    return builder.toDirectory();
  }
コード例 #5
0
  public Directory buildInternalDirectory(InternalDirectoryConfiguration configuration) {
    ImmutableDirectory.Builder builder = createBuilder();
    builder.setAllowedOperations(EnumSet.allOf(OperationType.class));
    builder.setActive(configuration.isActive());
    builder.setId(configuration.getDirectoryId());
    builder.setImplementationClass(InternalDirectory.class.getName());
    builder.setName(configuration.getName());
    builder.setType(DirectoryType.INTERNAL);

    HashMap<String, String> map = new HashMap<String, String>();
    map.put(
        InternalDirectory.ATTRIBUTE_USER_ENCRYPTION_METHOD,
        PasswordEncoderFactory.ATLASSIAN_SECURITY_ENCODER);
    map.put(
        DirectoryImpl.ATTRIBUTE_KEY_USE_NESTED_GROUPS,
        Boolean.valueOf(configuration.isNestedGroupsEnabled()).toString());
    builder.setAttributes(map);

    return builder.toDirectory();
  }