<p>Add only user/password/role.</p>
@param pUserName User Name
@param pPassw User password
@param pRole User role
@throws Exception - an exception
506207
@Override
  public final void addUser(final String pUserName,
    final String pPassw, final String pRole) throws Exception {
    String query = "select USERTOMCAT.ITSUSER as ITSUSER, ITSROLE"
      + " from USERTOMCAT join USERROLETOMCAT"
        + " on USERROLETOMCAT.ITSUSER = USERTOMCAT.ITSUSER;";
    IRecordSet<RS> recordSet = null;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      recordSet = getSrvDatabase().retrieveRecords(query);
      if (recordSet.moveToFirst()) {
        throw new Exception("There are already user credentials!");
      }
      String addUserQ =
        "insert into USERTOMCAT (ITSUSER, ITSPASSWORD) values ('" + pUserName
          + "', '" + pPassw + "');";
      String addUserRoleQ =
        "insert into USERROLETOMCAT (ITSUSER, ITSROLE) values ('" + pUserName
          + "', '" + pRole + "');";
      this.srvDatabase.executeQuery(addUserQ);
      this.srvDatabase.executeQuery(addUserRoleQ);
      this.srvDatabase.commitTransaction();
      this.isThereAnyUser = true;
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
      if (recordSet != null) {
        recordSet.close();
      }
    }
  }
1201393
protected void addUserToRole(String user, String role) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, CLASS_NAME + "addUserToRole", new Object[] { user, role });
        }
        Set<String> usersForTheRole = roleToUserMap.get(role);
        if (usersForTheRole != null) {
            usersForTheRole.add(user);
        } else {
            usersForTheRole = new HashSet<String>();
            usersForTheRole.add(user);
        }
        roleToUserMap.put(role, usersForTheRole);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, CLASS_NAME + "addUserToRole");
        }
    }
1237091
@SuppressWarnings("unused")
    public void setBasicAuth(@Nullable String username, @Nullable String password) {
        mUsername = username;
        mPassword = password;
    }
950008
private void connect(final URL pURL, PasswordAuthentication pAuth, String pAuthType, int pRetries) throws IOException {
        // Find correct port
        final int port = (pURL.getPort() > 0)
                ? pURL.getPort()
                : HTTP_DEFAULT_PORT;

        // Create socket if we don't have one
        if (socket == null) {
            //socket = new Socket(pURL.getHost(), port); // Blocks...
            socket = createSocket(pURL, port, connectTimeout);
            socket.setSoTimeout(timeout);
        }

        // Get Socket output stream
        OutputStream os = socket.getOutputStream();

        // Connect using HTTP
        writeRequestHeaders(os, pURL, method, requestProperties, usingProxy(), pAuth, pAuthType);

        // Get response input stream
        InputStream sis = socket.getInputStream();
        BufferedInputStream is = new BufferedInputStream(sis);

        // Detatch reponse headers from reponse input stream
        InputStream header = detatchResponseHeader(is);

        // Parse headers and set response code/message
        responseHeaders = parseResponseHeader(header);
        responseHeaderFields = parseHeaderFields(responseHeaders);

        //System.err.println("Headers fields:");
        //responseHeaderFields.list(System.err);
        // Test HTTP response code, to see if further action is needed
        switch (getResponseCode()) {
            case HTTP_OK:
                // 200 OK
                inputStream = is;
                errorStream = null;
                break;

                /*
                  case HTTP_PROXY_AUTH:
                  // 407 Proxy Authentication Required
                  */
            case HTTP_UNAUTHORIZED:
                // 401 Unauthorized
                // Set authorization and try again.. Slightly more compatible
                responseCode = -1;

                // IS THIS REDIRECTION??
                //if (instanceFollowRedirects) { ???
                String auth = getHeaderField(HEADER_WWW_AUTH);

                // Missing WWW-Authenticate header for 401 response is an error
                if (StringUtil.isEmpty(auth)) {
                    throw new ProtocolException("Missing \"" + HEADER_WWW_AUTH + "\" header for response: 401 " + responseMessage);
                }

                // Get real mehtod from WWW-Authenticate header
                int SP = auth.indexOf(" ");
                String method;
                String realm = null;

                if (SP >= 0) {
                    method = auth.substring(0, SP);
                    if (auth.length() >= SP + 7) {
                        realm = auth.substring(SP + 7);  // " realm=".lenght() == 7
                    }

                    // else no realm
                }
                else {
                    // Default mehtod is Basic
                    method = SimpleAuthenticator.BASIC;
                }

                // Get PasswordAuthentication
                PasswordAuthentication pa = Authenticator.requestPasswordAuthentication(NetUtil.createInetAddressFromURL(pURL), port,
                        pURL.getProtocol(), realm, method);

                // Avoid infinite loop
                if (pRetries++ <= 0) {
                    throw new ProtocolException("Server redirected too many times (" + maxRedirects + ") (Authentication required: " + auth + ")");  // This is what sun.net.www.protocol.http.HttpURLConnection does
                }
                else if (pa != null) {
                    connect(pURL, pa, method, pRetries);
                }
                break;
            case HTTP_MOVED_PERM:
                // 301 Moved Permanently
            case HTTP_MOVED_TEMP:
                // 302 Found
            case HTTP_SEE_OTHER:
                // 303 See Other
                /*
                  case HTTP_USE_PROXY:
                  // 305 Use Proxy
                  // How do we handle this?
                  */
            case HTTP_REDIRECT:
                // 307 Temporary Redirect
                //System.err.println("Redirecting " + getResponseCode());
                if (instanceFollowRedirects) {
                    // Redirect
                    responseCode = -1;                 // Because of the java.net.URLConnection

                    // getResponseCode implementation...
                    // ---
                    // I think redirects must be get?
                    //setRequestMethod("GET");
                    // ---
                    String location = getHeaderField("Location");
                    URL newLoc = new URL(pURL, location);

                    // Test if we can reuse the Socket
                    if (!(newLoc.getAuthority().equals(pURL.getAuthority()) && (newLoc.getPort() == pURL.getPort()))) {
                        socket.close();                 // Close the socket, won't need it anymore
                        socket = null;
                    }
                    if (location != null) {
                        //System.err.println("Redirecting to " + location);
                        // Avoid infinite loop
                        if (--pRetries <= 0) {
                            throw new ProtocolException("Server redirected too many times (5)");
                        }
                        else {
                            connect(newLoc, pAuth, pAuthType, pRetries);
                        }
                    }
                    break;
                }

                // ...else, fall through default (if no Location: header)
            default :
                // Not 200 OK, or any of the redirect responses
                // Probably an error...
                errorStream = is;
                inputStream = null;
        }

        // --- Need rethinking...
        // No further questions, let the Socket wait forever (until the server
        // closes the connection)
        //socket.setSoTimeout(0);
        // Probably not... The timeout should only kick if the read BLOCKS.
        // Shutdown output, meaning any writes to the outputstream below will
        // probably fail...
        //socket.shutdownOutput();
        // Not a good idea at all... POSTs need the outputstream to send the
        // form-data.
        // --- /Need rethinking.
        outputStream = os;
    }
256277
@PUT
  @Path("{user}")
  @Consumes(MediaType.TEXT_PLAIN)
  public Response addUser(@PathParam("user") String username, @HeaderParam("Authorization") @DefaultValue("no token") String auth, String message) throws Exception {
    if(!this.isAuth(auth)) {
      throw new Exception("Unauthorized!");
    }
    if( realm != null ){
      AuthenticationManagerRequest req = new AuthenticationManagerRequest();
      req.setAccountName(username);
      req.setPassword(message);
      req.setRequestType(RequestType.ADD);
      
      sendMessage(req);
      return Response.created(new URI("")).build();
    }
    return Response.status(Status.NOT_FOUND).build();
  }
960982
@SneakyThrows
    protected boolean createUserResource(final Principal p, final Credential credential) {
        val user = new UserResource(CoreSchema.USER_DESCRIPTOR);
        this.mapper.map(user, p, credential);
        return endpoint.create(user) != null;
    }
380421
@Post("/metadata/{projectName}/repos/{repoName}/perm/users")
    public CompletableFuture<Revision> addSpecificUserPermission(
            @Param("projectName") String projectName,
            @Param("repoName") String repoName,
            IdentifierWithPermissions memberWithPermissions,
            Author author) {
        final User member = new User(loginNameNormalizer.apply(memberWithPermissions.id()));
        return mds.addPerUserPermission(author, projectName, repoName,
                                        member, memberWithPermissions.permissions());
    }
748996
boolean authorize(String resource) throws IOException {
    if (passwordProvider == null) {
      throw new IOException(
          "Authorization failed - no password provider present "
              + "(you must call setPasswordProvider)");
    }

    if (passwordProvider.canAuthenticate(resource)) {
      // RPC code FOR SANE_NET_AUTHORIZE
      outputStream.write(SaneRpcCode.SANE_NET_AUTHORIZE);
      outputStream.write(resource);
      outputStream.write(passwordProvider.getUsername(resource));
      writePassword(resource, passwordProvider.getPassword(resource));
      outputStream.flush();

      // Read dummy reply and discard (according to the spec, it is unused).
      inputStream.readWord();
      return true;
    }

    return false;
  }
890171
public ServerUpdater addRolesToUser(User user, Collection<Role> roles) {
        delegate.addRolesToUser(user, roles);
        return this;
    }
973319
@SneakyThrows
    protected boolean createUserResource(final Principal p, final Credential credential) {
        val user = new UserResource();
        this.mapper.map(user, p, credential);
        return scimService.create("Users", user) != null;
    }
650268
public static void setUser(String userName, String password){
        getImpl().getDirectoryServiceClient().setUser(userName, password);
    }
1374754
public static void main(String[] args) {
		if (args.length < 2) {
			System.err.println("Two arguments needed as username and password");
			System.exit(-1);
		}
		User user = new User();
		user.name = args[0];
		user.password.setPassword(args[1].toCharArray());
		for (int i = 2; i<args.length; i++) {
			user.roles.add(new UserRole(args[i].trim()));
		}
		System.out.println(user.format());
	}
563359
def addUsersToRole(self, rolename, users):
        
        params = {
            "f" : "json",
            "rolename" : rolename,
            "users" : users
        }
        rURL = self._url + "/roles/addUsersToRole"
        return self._post(url=rURL, param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
382686
public void map(final RestletUtilUser user, final Role role)
    {
        try
        {
            this.addRoleMapping(new RoleMapping(user, role));
        }
        catch(final RepositoryException e)
        {
            throw new RuntimeException("Found unexpected exception while adding role mapping", e);
        }
    }
779297
public void insertSubEntry(CmsClientSitemapEntry entry, int position, I_CmsSitemapController controller) {

        entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller);
        m_subEntries.add(position, entry);
        updatePositions(position);
    }
1064128
public Response addRosterEntry(String username, RosterItemEntity rosterItemEntity) {
		return restClient.post("users/" + username + "/roster", rosterItemEntity, new HashMap<String, String>());
	}
668602
public PasswordAuthentication registerPasswordAuthentication(URL pURL, PasswordAuthentication pPA) {
        return registerPasswordAuthentication(NetUtil.createInetAddressFromURL(pURL),
                pURL.getPort(),
                pURL.getProtocol(),
                null, // Prompt/Realm
                BASIC,
                pPA);
    }