Package org.sonatype.security.ldap.dao

Examples of org.sonatype.security.ldap.dao.LdapAuthConfiguration


    return defaultLdapContextFactory;
  }

  public static LdapAuthConfiguration getLdapAuthConfiguration(CLdapServerConfiguration ldapServer) {
    CUserAndGroupAuthConfiguration userAndGroupsConf = ldapServer.getUserAndGroupConfig();
    LdapAuthConfiguration authConfig = new LdapAuthConfiguration();

    authConfig.setEmailAddressAttribute(userAndGroupsConf.getEmailAddressAttribute());
    authConfig.setUserBaseDn(StringUtils.defaultString(userAndGroupsConf.getUserBaseDn(), ""));
    authConfig.setUserIdAttribute(userAndGroupsConf.getUserIdAttribute());
    authConfig.setUserObjectClass(userAndGroupsConf.getUserObjectClass());
    authConfig.setPasswordAttribute(userAndGroupsConf.getUserPasswordAttribute());
    authConfig.setUserRealNameAttribute(userAndGroupsConf.getUserRealNameAttribute());

    authConfig.setGroupBaseDn(StringUtils.defaultString(userAndGroupsConf.getGroupBaseDn(), ""));
    authConfig.setGroupIdAttribute(userAndGroupsConf.getGroupIdAttribute());
    authConfig.setGroupMemberAttribute(userAndGroupsConf.getGroupMemberAttribute());
    authConfig.setGroupMemberFormat(userAndGroupsConf.getGroupMemberFormat());
    authConfig.setGroupObjectClass(userAndGroupsConf.getGroupObjectClass());
    authConfig.setUserSubtree(userAndGroupsConf.isUserSubtree());
    authConfig.setGroupSubtree(userAndGroupsConf.isGroupSubtree());
    authConfig.setUserMemberOfAttribute(userAndGroupsConf.getUserMemberOfAttribute());
    authConfig.setLdapGroupsAsRoles(userAndGroupsConf.isLdapGroupsAsRoles());
    authConfig.setLdapFilter(userAndGroupsConf.getLdapFilter());
    return authConfig;
  }
View Full Code Here


  public static void testUserAuthentication(CLdapServerConfiguration ldapServer, LdapUserDAO ldapUserDAO,
                                            LdapGroupDAO ldapGroupDAO) throws LdapDAOException
  {
    LdapContextFactory contextFactory = getLdapContextFactory(ldapServer, false);
    LdapAuthConfiguration authConfig = getLdapAuthConfiguration(ldapServer);

    new DefaultLdapConnector("test", ldapUserDAO, ldapGroupDAO, contextFactory, authConfig);

  }
View Full Code Here

      throws LdapDAOException
  {
    LdapContext context = null;
    try {
      context = this.getLdapContextFactory().getSystemLdapContext();
      LdapAuthConfiguration conf = this.getLdapAuthConfiguration();

      SortedSet<LdapUser> users = this.ldapUserManager.getUsers(context, conf, count);

      // only need to update membership when using static mapping
      if (isStaticGroupMapping(conf)) {
View Full Code Here

             LdapDAOException
  {
    LdapContext context = null;
    try {
      context = this.getLdapContextFactory().getSystemLdapContext();
      LdapAuthConfiguration conf = this.getLdapAuthConfiguration();

      LdapUser ldapUser = this.ldapUserManager.getUser(username, context, conf);

      // only need to update membership when using static mapping
      if (isStaticGroupMapping(conf)) {
View Full Code Here

      throws LdapDAOException
  {
    LdapContext context = null;
    try {
      context = this.getLdapContextFactory().getSystemLdapContext();
      LdapAuthConfiguration conf = this.getLdapAuthConfiguration();

      // make sure the username is at least an empty string
      if (username == null) {
        username = "";
      }

      // is this a role-based search?
      if (roleIds != null && !roleIds.isEmpty()) {

        // do we have any roles to check?
        if (!conf.isLdapGroupsAsRoles()) {
          return new TreeSet<>();
        }

        // searchUsers is expensive with static mapping, so check roles exist in LDAP first
        if (isStaticGroupMapping(conf) && CollectionUtils.intersection( //
View Full Code Here

    try {
      SortedSet<String> results = new TreeSet<String>();

      context = this.getLdapContextFactory().getSystemLdapContext();
      LdapAuthConfiguration conf = this.getLdapAuthConfiguration();

      results.addAll(this.ldapGroupManager.getAllGroups(context, conf));

      return results;
    }
View Full Code Here

  {
    LdapContext context = null;

    try {
      context = this.getLdapContextFactory().getSystemLdapContext();
      LdapAuthConfiguration conf = this.getLdapAuthConfiguration();

      return this.ldapGroupManager.getGroupName(groupId, context, conf);
    }
    catch (NamingException e) {
      String message = "Failed to retrieve ldap information for users.";
View Full Code Here

TOP

Related Classes of org.sonatype.security.ldap.dao.LdapAuthConfiguration

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.