Package org.objectweb.joram.shared.security

Examples of org.objectweb.joram.shared.security.Identity


   */
  private AgentId getProxyId(Identity identity,
                            String inaddr) throws Exception {

    AgentId userProxId = null;
    Identity userIdentity = (Identity) usersTable.get(identity.getUserName());
    if (userIdentity == null) {
      if (logger.isLoggable(BasicLevel.ERROR))
        logger.log(BasicLevel.ERROR, "User [" + identity.getUserName() + "] does not exist");
      throw new Exception("User [" + identity.getUserName() + "] does not exist");
    }

    if (!userIdentity.check(identity)) {
      if (logger.isLoggable(BasicLevel.ERROR))
        logger.log(BasicLevel.ERROR, "identity check failed.");
      throw new Exception("identity check failed.");
    }

View Full Code Here


   * notification notifying of the creation of an administrator proxy.
   *
   * @param adminNot  the <code>AdminNotification</code> notification.
   */
  private void handleAdminNotification(AdminNotification adminNot) {
    Identity identity = adminNot.getIdentity();

    try {
      //identity.validate();

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG,
                   "AdminTopic store identity = " + identity);
     
      usersTable.put(identity.getUserName(), identity);
      proxiesTable.put(identity.getUserName(), adminNot.getProxyId());

      clients.put(adminNot.getProxyId(), new Integer(READWRITE));

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG,
                   identity.getUserName() + " successfully set as admin client.");
    } catch (Exception e) {
      if (logger.isLoggable(BasicLevel.ERROR))
        logger.log(BasicLevel.ERROR, "Exception:: ", e);
    }
  }
View Full Code Here

  private void doProcess(CreateUserRequest request,
                        AgentId replyTo,
                        String msgId) throws UnknownServerException, RequestException {
    if (checkServerId(request.getServerId())) {
      // If this server is the target server, process the request.
      Identity identity = request.getIdentity();
      String name = identity.getUserName();

      AgentId proxId = (AgentId) proxiesTable.get(name);
      String info;

      // The user has already been set.
      if (proxId != null) {
        Identity userIdentity = (Identity) usersTable.get(name);
        if (logger.isLoggable(BasicLevel.INFO))
          logger.log(BasicLevel.INFO, "User [" + name + "] already exists : " + userIdentity);
        try {
          if (! userIdentity.check(identity)) {
            throw new RequestException("User [" + name + "] already exists"
                                       + " but with a different password.");
          }
        } catch (Exception e) {
          throw new RequestException("User [" + name + "] already exists :: Exception :" + e.getMessage());
View Full Code Here

      // If the user does not exist: throwing an exception:
      if (! usersTable.containsKey(name))
        throw new RequestException("User [" + name + "] does not exist");

      Identity newIdentity = request.getNewIdentity();
      // If the new name is already taken by an other user than the modified
      // one:
      if (! newIdentity.getUserName().equals(name)
          && (usersTable.containsKey(newIdentity.getUserName())))
        throw new RequestException("Name [" + newIdentity.getUserName() + "] already used");

      if (usersTable.containsKey(name)) {
        usersTable.remove(name);
        proxiesTable.remove(name);
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG, "doProcess UpdateUser:: store (in usersTable) this identity = " + newIdentity);
        usersTable.put(newIdentity.getUserName(), newIdentity);
        proxiesTable.put(newIdentity.getUserName(), proxId);
      }

      info = strbuf.append("Request [").append(request.getClass().getName())
      .append("], processed by AdminTopic on server [").append(serverId)
      .append("], successful [true]: user [").append(name)
      .append("] has been updated to [").append(newIdentity.getUserName()).
      append("]").toString();
      strbuf.setLength(0);

      distributeReply(replyTo, msgId, new AdminReply(true, info));
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void createUser(String user, String passwd, int serverId, String identityClassName) throws Exception {
    Identity identity = null;
    try {
      identity = (Identity) Class.forName(identityClassName).newInstance();
      if (passwd != null)
        identity.setIdentity(user, passwd);
      else
        identity.setUserName(user);
    } catch (Exception e) {
      throw new RequestException(e.getMessage());
    }
    CreateUserRequest request = new CreateUserRequest(identity, serverId, null);
    FwdAdminRequestNot createNot = new FwdAdminRequestNot(request, null, null);
View Full Code Here

TOP

Related Classes of org.objectweb.joram.shared.security.Identity

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.