Package com.esri.gpt.framework.security.identity

Examples of com.esri.gpt.framework.security.identity.IdentityAdapter


  @Override
  protected FeedWriter makeFeedWriter(HttpServletRequest request, RequestContext context, PrintWriter printWriter, MessageBroker messageBroker, RestQuery query) {
    ResponseFormat format = getResponseFormat(request,query);
    if (format.equals(ResponseFormat.atom)){
      ResourceIdentifier resourceIdentifier = ResourceIdentifier.newIdentifier(context);
      IdentityAdapter idAdapter =  context.newIdentityAdapter();
      ErosEmailFinder emailFinder = new ErosEmailFinder(context, idAdapter);
     
      String sTarget = query.getResponseTarget();
      RecordSnippetWriter.Target target = RecordSnippetWriter.Target.checkValueOf(sTarget);
      AtomFeedWriter atomWriter = new ErosAtomFeedWriter(emailFinder, resourceIdentifier, printWriter);
View Full Code Here


   * @throws ImsServiceException if any other problem occurs
   */
  private void loadUserGroups(User user) throws SQLException, ImsServiceException {
    try {
      RequestContext requestContext = RequestContext.extract(null);
      IdentityAdapter identityAdapter = requestContext.newIdentityAdapter();
      identityAdapter.readUserGroups(user);
    } catch (Exception ex) {
      throw new ImsServiceException("Error evaluation asserting groups.");
    }
  }
View Full Code Here

    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());
      userUpdate.setLocalID(user.getLocalID());
      userUpdate.setDistinguishedName(user.getDistinguishedName());
      userUpdate.setProfile(_activeUserAttributes);
      try {
        idAdapter.readUserProfile(userUpdate);
      } catch (Throwable t) {
        getLogger().log(Level.SEVERE,"Error reading user profile.",t);
      }
    } else {
      _activeUserAttributes = getNewUser().getProfile();
View Full Code Here

  MessageBroker msgBroker = extractMessageBroker();
  try {
   
    // execute the password change,
    // set success massage and navigation outcome
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.changePassword(context.getUser(),getChangePasswordCriteria());
    msgBroker.addSuccessMessage("identity.changePassword.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);
   
  } catch (CredentialsDeniedException e) {
    msgBroker.addErrorMessage("identity.changePassword.err.old");
View Full Code Here

  try {
   
    // initialize parameters, recover the password
    String sUsername = getRecoverPasswordCriteria().getUsername();
    String sEmail = getRecoverPasswordCriteria().getEmailAddress();
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    User user = idAdapter.recoverPassword(getRecoverPasswordCriteria());
    if (user != null) {
     
      // get the new password
      UsernamePasswordCredentials upCred;
      upCred = user.getCredentials().getUsernamePasswordCredentials();
View Full Code Here

  MessageBroker msgBroker = extractMessageBroker();
  try {
   
    // register the user,
    // add the success message, set navigation outcome to the home page
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.registerUser(getNewUser());
    msgBroker.addSuccessMessage("catalog.identity.userRegistration.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);
  
    // attempt to login if not single sign-on mode
    boolean bSingleSignOn = false;
    if (!bSingleSignOn) {
     
      // authenticate the user, add the successful login message
      User user = extractRequestContext().getUser();
      user.reset();
      user.setCredentials(getNewUser().getCredentials());
      idAdapter.authenticate(user);
      String[] args = new String[1];
      args[0] = user.getName();
      extractMessageBroker().addSuccessMessage("identity.login.success",args);
    } else {
View Full Code Here

    userUpdate.setProfile(getActiveUserAttributes());
   
    // execute the update,
    // update the in memory profile for the active user
    // set the success message and navigation outcome
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.updateUserProfile(userUpdate);
    user.setProfile(userUpdate.getProfile());
    msgBroker.addSuccessMessage("catalog.identity.myProfile.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);
   
  } catch (EmailPolicyException e) {
View Full Code Here

* @throws SQLException if a database communication exception occurs
*/
protected void authenticate(RequestContext context, Credentials credentials)
  throws CredentialsDeniedException, IdentityException, SQLException {
  getLogger().finer("Authenticating user...");
  IdentityAdapter idAdapter = context.newIdentityAdapter();
  User user = context.getUser();
  user.reset();
  user.setCredentials(credentials);
  try {
    idAdapter.authenticate(user);
  } catch(CredentialsDeniedException e) {
    if (credentials instanceof UsernamePasswordCredentials) {
      String sUser = ((UsernamePasswordCredentials)credentials).getUsername();
      getLogger().finer("Authentication failed for: "+sUser);
    } else {
View Full Code Here

/**
* Instantiates a new Identity adapter.
* @return the new identity adapter
*/
protected IdentityAdapter newIdentityAdapter() {
  IdentityAdapter identityAdapter = null;
  try {
    String adapterClassName = getIdentityConfiguration().getAdapterClassName();
    if (adapterClassName.length() == 0) {
      throw new ConfigurationException(
          "The identity adapter class name was not properly configured.");
    } else {
      Class<?> clsAdapter = Class.forName(adapterClassName);
      Object objAdapter = clsAdapter.newInstance();
      if (objAdapter instanceof IdentityAdapter) {
        identityAdapter = (IdentityAdapter) objAdapter;
        identityAdapter.setApplicationConfiguration(this);
      } else {
        throw new ConfigurationException(
            "The identity adapter class name is invalid: " + adapterClassName);
      }
    }
  } catch (Throwable t) {
    identityAdapter = new UnconfiguredIdentityAdapter();
    identityAdapter.setApplicationConfiguration(this);
    LogUtil.getLogger().log(Level.SEVERE,
        "Unable to create a new IdenityAdapter.", t);
  }
  return identityAdapter;
}
View Full Code Here

  String attributeValue = Val.chkStr(request.getParameter("av"));
  if(filter.length() == 0) {
    response.getWriter().write("{ \"response\" : \"noResults\" }");
    return;
  }
  IdentityAdapter idAdapter = context.newIdentityAdapter();
  Users users = idAdapter.readUsers(filter,null);
  for (User u : users.values()){   
    if(isAddAttributeRequest){
      try{
        idAdapter.addAttribute(u.getDistinguishedName(), attributeName, attributeValue);
      }catch(AttributeInUseException aiue){
        // TODO : do nothing if attribute exists ? or overwrite ?
      }
    }else {
      idAdapter.removeAttribute(u.getDistinguishedName(), attributeName, attributeValue);
    }     
  }
  writeCharacterResponse(response,"{ \"response\" : \"User attribute modification was successful.\" }","UTF-8",mimeType+";charset=UTF-8");
}
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.security.identity.IdentityAdapter

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.