Examples of LDAPUser


Examples of edu.monash.merc.dto.LDAPUser

  public String searchParty() {

    String authcateId = null;
    try {
      LDAPUser user = this.ldapService.searchLdapUser(party);

      // get researcher nla id from rm ws
      authcateId = user.getUid();
      System.out.println("authcateId: " + authcateId);

      String nlaId = this.partyActivitySvc.getNlaId(authcateId);
      System.out.println("nlaId: " + nlaId);
View Full Code Here

Examples of edu.monash.merc.dto.LDAPUser

            }

            NamingEnumeration<SearchResult> answer = dir.search(baseDn, filter, ctls);
            while (answer.hasMore()) {
                SearchResult st = (SearchResult) answer.next();
                LDAPUser usr = new LDAPUser();

                Attributes atts = st.getAttributes();

                Attribute mailAtt = atts.get(mailAttrName);
                if (mailAtt != null) {
                    usr.setMail((String) mailAtt.get());
                }

                Attribute cnAtt = atts.get(cnAttrName);
                if (cnAtt != null) {
                    usr.setDisplayName((String) cnAtt.get());
                }

                Attribute uidAtt = atts.get(uidAttrName);
                if (uidAtt != null) {
                    usr.setUid((String) uidAtt.get());
                }

                Attribute ptitleAtt = atts.get(personalTitleAttrName);
                if (ptitleAtt != null) {
                    usr.setTitle((String) ptitleAtt.get());
                }

                Attribute genderAtt = atts.get(genderAttrName);
                if (genderAtt != null) {
                    usr.setGender((String) genderAtt.get());
                }

                Attribute surNameAtt = atts.get(snAttrName);
                if (surNameAtt != null) {
                    usr.setLastName((String) surNameAtt.get());
                }

                Attribute firstNameAtt = atts.get(givennameAttrName);
                if (firstNameAtt != null) {
                    usr.setFirstName((String) firstNameAtt.get());
                }

                return usr;
            }
        } catch (NamingException nex) {
View Full Code Here

Examples of edu.monash.merc.dto.LDAPUser

            String displayName = cnAtt != null ? (String) cnAtt.get() : "none";

            Attribute genderNameAtt = atts.get(genderAttrName);
            String gender = genderNameAtt != null ? (String) genderNameAtt.get() : "male";

            LDAPUser usr = new LDAPUser();
            usr.setUid(uid);
            usr.setDisplayName(displayName);
            usr.setGender(gender);
            usr.setMail(mail);
            return usr;
        } catch (NamingException e) {
            logger.error(e.getMessage());
            return null;
        } finally {
View Full Code Here

Examples of edu.monash.merc.dto.LDAPUser

        ldap.initEnv(ldapProp);

        String usrdn = ldap.findUserDn("xiyu");
        System.out.println("user dn: " + usrdn);

        LDAPUser luser = ldap.findUserInfo("Virginia.Gutierre@monash.edu");
        if (luser != null) {
            System.out.println("title: " + luser.getTitle());
            System.out.println("display name: " + luser.getDisplayName());
            System.out.println("authencate id: " + luser.getUid());
            System.out.println("last name: " + luser.getLastName());
            System.out.println("frist name: " + luser.getFirstName());
            System.out.println("gender : " + luser.getGender());
            System.out.println("mail: " + luser.getMail());
        }
        LDAPUser usr = ldap.validateLdapUser("mercsaka", "merc27jira");
        if (usr == null) {
            System.out.println("user is not found");
        } else {
            System.out.println("display name: " + usr.getDisplayName());
            System.out.println("frist name: " + usr.getFirstName());
            System.out.println("last name: " + usr.getLastName());
            System.out.println("gender : " + usr.getGender());
            System.out.println("mail: " + usr.getMail());
        }

        // ldap.login("mercsaka", "merc27jira");
    }
View Full Code Here

Examples of org.apache.cloudstack.ldap.LdapUser

        String finalAccountName = getAccountName();
        Long finalDomainId = getDomainId();
    callContext.setEventDetails("Account Name: " + finalAccountName
        + ", Domain Id:" + finalDomainId);
    try {
      final LdapUser user = _ldapManager.getUser(username);
      validateUser(user);
      final UserAccount userAccount = createCloudstackUserAccount(user, finalAccountName, finalDomainId);
      if (userAccount != null) {
        final AccountResponse response = _responseGenerator
            .createUserAccountResponse(userAccount);
View Full Code Here

Examples of org.apache.cloudstack.ldap.LdapUser

        final CallContext callContext = getCurrentContext();
        String finalAccountName = getAccountName();
        Long finalDomainId = getDomainId();
        callContext.setEventDetails("Account Name: " + finalAccountName + ", Domain Id:" + finalDomainId);
        try {
            final LdapUser user = _ldapManager.getUser(username);
            validateUser(user);
            final UserAccount userAccount = createCloudstackUserAccount(user, finalAccountName, finalDomainId);
            if (userAccount != null) {
                final AccountResponse response = _responseGenerator.createUserAccountResponse(ResponseView.Full, userAccount);
                response.setResponseName(getCommandName());
View Full Code Here

Examples of org.apache.jetspeed.om.security.ldap.LDAPUser

     */
    public Iterator getRoles(String username)
        throws JetspeedSecurityException
    {
        StringTokenizer st;
        LDAPUser user;
        try
        {
            if (cachingEnable)
            {
                Iterator result = JetspeedSecurityCache.getRoles(username);
                if (null != result)
                {
                    return result;
                }
            }
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new RoleException("Failed to Retrieve User: ", e);
        }

        HashMap roles= new HashMap();

        try
        {
            for (Enumeration enum1 = user.getGroupRoles().elements(); enum1.hasMoreElements();)
            {
                st = new StringTokenizer((String)enum1.nextElement(), ",");
                LDAPGroup group = new LDAPGroup(st.nextToken(),false);
                LDAPRole role = new LDAPRole(st.nextToken(),false);
                BaseJetspeedGroupRole groupRole = new BaseJetspeedGroupRole();
View Full Code Here

Examples of org.apache.jetspeed.om.security.ldap.LDAPUser

  }

    public void grantRole(String username, String roleName, String groupName)
        throws JetspeedSecurityException
    {
        LDAPUser user;
        LDAPRole role;
        try
        {
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
            role = (LDAPRole)JetspeedSecurity.getRole(roleName);
        }
        catch(JetspeedSecurityException e)

        {
            throw new RoleException("Failed to Retrieve User or Role: ", e);
        }

        try
        {
            user.addGroupRole(groupName, roleName);
            user.update(false);

            if (cachingEnable)
            {
                JetspeedSecurityCache.addRole(username, role);
            }
View Full Code Here

Examples of org.apache.jetspeed.om.security.ldap.LDAPUser

  }

    public void revokeRole(String username, String rolename, String groupname)
        throws JetspeedSecurityException
    {
        LDAPUser user;

        try
        {
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new RoleException("Failed to Retrieve User: ", e);
        }

        try
        {
            user.removeGroupRole(groupname, rolename);
            user.update(false);

            if (cachingEnable)
            {
                JetspeedSecurityCache.removeRole(username, rolename, groupname);
            }
View Full Code Here

Examples of org.apache.jetspeed.om.security.ldap.LDAPUser

    public boolean hasRole(String username, String roleName, String groupName)
        throws JetspeedSecurityException
    {
        StringTokenizer st;
        LDAPUser user;
        try
        {
            if (cachingEnable)
            {
                CachedAcl acl = JetspeedSecurityCache.getAcl(username);
                if (null != acl)
                {
                    return acl.hasRole(roleName, groupName);
                }
            }
            user = (LDAPUser)JetspeedSecurity.getUser(new UserNamePrincipal(username));
        }
        catch(JetspeedSecurityException e)
        {
            throw new RoleException("Failed to Retrieve User: ", e);
        }
        try
        {
            for (Enumeration enum1 = user.getGroupRoles().elements(); enum1.hasMoreElements();)
            {
                st = new StringTokenizer((String)enum1.nextElement(),",");
                String gn = st.nextToken();
                String rn = st.nextToken();
                if (rn.equalsIgnoreCase(roleName) && gn.equalsIgnoreCase(groupName))
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.