Package com.esri.gpt.framework.security.principal

Examples of com.esri.gpt.framework.security.principal.UserAttributeMap


  }
  if (ldapAttributes != null) {

    // iterate through the attributes of the supplied user profile
    LdapNameMapping  nameMap  = getConfiguration().getUserProperties().getUserProfileMapping();
    UserAttributeMap localMap = user.getProfile();
    ModificationItem modItem;
    for (UserAttribute localAttr: localMap.values()) {
     
      // determine the local and LDAP keys
      String sLocalKey = localAttr.getKey();
      String sLocalValue = localAttr.getValue();
      String sLdapKey = nameMap.findLdapName(localAttr.getKey());
View Full Code Here


* @throws NamingException if an LDAP naming exception occurs
*/
protected void readUserProfile(DirContext dirContext, User user)
  throws NamingException {
  LdapNameMapping nameMap = getConfiguration().getUserProperties().getUserProfileMapping();
  UserAttributeMap userProf = user.getProfile();
  UserAttributeMap configured = getConfiguration().getIdentityConfiguration().getUserAttributeMap();
 
  /* There were some issues with the initial integration of
   * Apache's LDAP implementation. The section below ensures that a user's
   * profile contains all configured attributes, even if they do not exist on
   * the LDAP side.
   */
  boolean bEnsureAllAttributes = true;
  if (bEnsureAllAttributes) {
    for (UserAttribute attr: configured.values()) {
      if (!userProf.containsKey(attr.getKey())) {
        userProf.set(attr.getKey(),"");
      }
    }
  }
 
  String sUserDN = user.getDistinguishedName();
  if (sUserDN.length() > 0) {
   
    // read current LDAP attribute values
    NamingEnumeration<?> enAttr = null;
    try {
      Attributes attributes = dirContext.getAttributes(sUserDN);
           
      if (attributes != null) {
        enAttr = attributes.getAll();
        while (enAttr.hasMore()) {
          Object oAttr = enAttr.next();
          if (oAttr instanceof Attribute) {
            Attribute attr = (Attribute)oAttr;
            String sLdapKey = attr.getID();
            Object oVal = attr.get();
                       
            // set the corresponding application user attribute
            String sAppKey = Val.chkStr(nameMap.findApplicationName(sLdapKey));
            if ((sAppKey.length() > 0) && configured.containsKey(sAppKey)) {
              if (oVal instanceof String) {
                userProf.set(sAppKey,(String)oVal);
              } else if (oVal == null) {
                userProf.set(sAppKey,"");
              }
View Full Code Here

public UserAttributeMap getActiveUserAttributes() {
  if (_activeUserAttributes == null) {
    RequestContext rc = extractRequestContext();
    User user = rc.getUser();
    if (user.getAuthenticationStatus().getWasAuthenticated()) {
      _activeUserAttributes = new UserAttributeMap(user.getProfile());
     
      // attempt to reload the user's profile
      IdentityAdapter idAdapter = rc.newIdentityAdapter();
      User userUpdate = new User();
      userUpdate.setKey(user.getKey());
View Full Code Here

public User getNewUser() {
  if (_newUser == null) {
    IdentityConfiguration idConfig = getIdentityConfiguration();
    _newUser = new User();
    _newUser.setCredentials(new UsernamePasswordCredentials());
    _newUser.setProfile(new UserAttributeMap(idConfig.getUserAttributeMap()));
  }
  return _newUser;
}
View Full Code Here

* @throws IdentityException if a system error occurs preventing the action
* @throws NamingException if an LDAP naming exception occurs
*/
protected String serializeUserAsJson(RequestContext context,User user) throws IdentityException, NamingException{
  String usersJson = "{ \"attributes\": [";
  UserAttributeMap attributes = user.getProfile();
  boolean first = true;
  List<String> sortedKeys=new ArrayList<String>(attributes.keySet());
  // Collections.sort(sortedKeys); TODO to sort or not ?
  for(int i=0; i <sortedKeys.size(); i++){
    UserAttribute attr = attributes.get(sortedKeys.get(i));
    String key = Val.chkStr(msgBroker.retrieveMessage("catalog.identity.profile.label." + attr.getKey()));
    String value = "";     
    value = Val.chkStr(attr.getValue());
    if(attr.getKey().equalsIgnoreCase("password")) continue;
    if(!first) {
View Full Code Here

private IdentitySupport             _supportedFunctions;
private UserAttributeMap            _userAttributeMap;

/** Default constructor. */
public IdentityConfiguration() {
  setUserAttributeMap(new UserAttributeMap());
  setConfiguredRoles(new Roles());
  setSupportedFunctions(new IdentitySupport());
  setLdapConfiguration(new LdapConfiguration(this));
  setMetadataManagementGroups(new Groups());
  setSimpleConfiguration(new SimpleIdentityConfiguration(this));
View Full Code Here

        props.addUserObjectClass(nlObj.item(i).getNodeValue());
      }
    }

    // user profile parameters
    UserAttributeMap uaMap = idConfig.getUserAttributeMap();
    NodeList nlUserAttr = (NodeList) xpath.evaluate(
        "users/userAttributeMap/attribute", ndLdap, XPathConstants.NODESET);
    for (int i = 0; i < nlUserAttr.getLength(); i++) {
      UserAttribute attr = new UserAttribute();
      attr.setKey(xpath.evaluate("@key", nlUserAttr.item(i)));
      attr.setLdapName(xpath.evaluate("@ldapName", nlUserAttr.item(i)));

      // TODO: need to do a better check to filter out badly defined
      // parameters
      boolean bIsLdap = (idConfig.getAdapterClassName().indexOf("Ldap") != -1);
      if (bIsLdap && (attr.getLdapName().length() > 0)) {
        uaMap.add(attr);
      }
    }
    ldapConfig.getUserProperties().getUserProfileMapping().configureFromUserAttributes(uaMap);

    // group properties
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.security.principal.UserAttributeMap

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.