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

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


          // read owner distinguished name
          HrRecord record = getEditor().getRepository();
          LocalDao localDao = new LocalDao(context);
          String uDN = localDao.readDN(record.getOwnerId());
          if (uDN.length() == 0) {
            User u = context.getUser();
            if (u != null) {
              uDN = u.getDistinguishedName();
            }
          }
          // check if this user already exist on the list of selectable publishers
          if (uDN.length() > 0) {
            boolean bExist = false;
            for (SelectItem si : getSelectablePublishers().getItems()) {
              if (si.getValue().equals(uDN)) {
                bExist = true;
                break;
              }
            }
            // if does not exist, try to finf him and add to this list
            if (!bExist) {
              Users allSelectablePublishers =
                      Publisher.buildSelectablePublishers(context, true);
              User owner = allSelectablePublishers.get(uDN);
              if (owner != null) {
                getSelectablePublishers().getItems().add(
                        new SelectItem(owner.getKey(), owner.getName()));
              }
            }
            // at least, select it
            getSelectablePublishers().setSelectedKey(uDN);
          }
View Full Code Here


              IntegrationContext ic = icf.newIntegrationContext();
              if (ic != null) {
                String samlUsername = ic.getUsernameFromSAMLToken(samlToken);
                RequestContext rc = context.getRequestContext();
                if ((rc != null) && (samlUsername != null)) {
                  User user = rc.getUser();
                  user.reset();
                  user.setCredentials(new UsernameCredential(samlUsername));
                  rc.newIdentityAdapter().authenticate(user);
                  context.getRequestOptions().getTransactionOptions().setPublicationMethod("seditor");

                  expr = "//tcExt:tcSecurity/tcExt:tcSecuredAction[tcExt:status='draft']";
                  Node ndTmp = (Node)xpath.evaluate(expr,ndSoapEnv,XPathConstants.NODE);
View Full Code Here

  for (User u : editablePublishers.values()) {
    if (u.getName().length() > 0) {
      hmEditablePublishers.put(u.getName().toLowerCase(), u.getKey());
    }
  }
  User tmpUser = new User();
  tmpUser.setDistinguishedName("*");
  getRequestContext().newIdentityAdapter().readUserGroups(tmpUser);
  allGroups = tmpUser.getGroups();

  isGptAdministrator = new RoleMap(getRequestContext().getUser()).get("gptAdministrator");
 
  try {

View Full Code Here

   * @throws SQLException
   * @throws NamingException
   * @throws IdentityException
   */
  public String[] makeUserAcl() {
    User user = _requestContext.getUser();
   
    /* groups have already been read for the user
    try {
      _requestContext.newIdentityAdapter().readUserGroups(user);
    } catch (IdentityException e) {
      LOGGER.severe(e.getMessage());
    } catch (NamingException e) {
      LOGGER.severe(e.getMessage());
    } catch (SQLException e) {
      LOGGER.severe(e.getMessage());
    }
    */
   
    Groups groups = user.getGroups();
    ArrayList<String> acls = new ArrayList<String>();
    for (Group group : groups.values()) {
      acls.add(makeAclString(group));
    }
    return acls.toArray(new String[0]);
View Full Code Here

         CredentialsDeniedException {
  String sSelectedKey = getSelectedKey();
  if (sSelectedKey.length() == 0) {
    return new Publisher(context);
  } else {
    User user = context.getUser();
    if (sSelectedKey.equals(user.getKey())) {
      return new Publisher(context);
    } else {
      Users users = Publisher.buildSelectablePublishers(context,forManagement);
      if (users.containsKey(sSelectedKey)) {
        return new Publisher(context,sSelectedKey);
View Full Code Here

      getApplicationConfiguration().getDownloadDataConfiguration();

    // get user email address
    setUserEmail(getParameterByKey(request, KEY_EMAIL));
    if (getUserEmail().length() == 0) {
      User user = context.getUser();
      setUserEmail(user != null ? user.getProfile().getEmailAddress() : "");
    }

    // get map service url
    setMapServiceUrl(getParameterByKey(request, KEY_MAPSERVICEURL));
View Full Code Here

protected void processSubAction(ActionEvent event, RequestContext context)
  throws AbortProcessingException, Exception  {
  try {
   
    // set the user credentials
    User user = context.getUser();
    user.reset();
    UsernamePasswordCredentials creds = new UsernamePasswordCredentials();
    creds.setUsername(getCredentials().getUsername());
    creds.setPassword(getCredentials().getPassword());
    user.setCredentials(creds);
   
    // authenticate the user
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.authenticate(user);
   
    // inform if sdi.suite integration is enabled
    IntegrationContextFactory icf = new IntegrationContextFactory();
    if (icf.isIntegrationEnabled()) {
      IntegrationContext ic = icf.newIntegrationContext();
      if (ic != null) {
        ic.ensureToken(user);
        ic.initializeUser(user);
      }
    }
   
    // set the outcome
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);
    String[] args = new String[1];
    args[0] = user.getName();
    extractMessageBroker().addSuccessMessage("identity.login.success",args);
  } catch (CredentialsDeniedException e) {
    extractMessageBroker().addErrorMessage("identity.login.err.denied");
  }
}
View Full Code Here

  _timeStarted = new Timestamp(System.currentTimeMillis());
  _timeCompleted = null;
  setApplicationContext(ApplicationContext.getInstance());
  ApplicationConfiguration config = getApplicationContext().getConfiguration();
  setConnectionBroker(new ConnectionBroker(config.getDatabaseReferences()));
  setUser(new User());
  boolean bWasUserInSession = false;
 
  if (request instanceof HttpServletRequest) {
    HttpServletRequest httpReq = (HttpServletRequest)request;
    HttpSession sn = httpReq.getSession(true);
    User user = (User)sn.getAttribute(USERKEY);
    if (user == null) {
      sn.setAttribute(USERKEY,getUser());
    } else {
      bWasUserInSession = true;
      setUser(user);
    }
    user = getUser();
  
    // check for single sign-on
    if (getIdentityConfiguration().getSingleSignOnMechanism().getActive()) {
      if (Val.chkStr(user.getKey()).startsWith("urn:openid:")) return;
     
      String sPrevious = user.getName();
      String sUsername = getIdentityConfiguration().getSingleSignOnMechanism().determineUsername(httpReq);
      if (!sPrevious.equals(sUsername)) {
        if (bWasUserInSession) {
          setUser(new User());
          sn.setAttribute(USERKEY,getUser());
          user = getUser();
        }
        if (sUsername.length() > 0) {
          user.setCredentials(new UsernameCredential(sUsername));
          try {
            newIdentityAdapter().authenticate(user);
          } catch (Exception e) {
            String sMsg = "An error occured while evaluating single sign-on credentials for: "+sUsername;
            setUser(new User());
            sn.setAttribute(USERKEY,getUser());
            getLogger().log(Level.SEVERE,sMsg,e);
          } finally {
            this.getConnectionBroker().closeAll();
          }
View Full Code Here

TOP

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

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.