Send user identity information to the identity manager.

        Raise a ServerError if an error occurs in the request process.

        @param username The logged in user.
        @param json_document The JSON payload for login.
193025
def login(self, username, json_document):
        
        url = '{}u/{}'.format(self.url, username)
        make_request(
            url, method='PUT', body=json_document, timeout=self.timeout)
1103467
public void sendJSON(String topicName, String payload) {
        if (topicName == null || topicName.length() == 0) {
            throw new JavametricsException("Topic names must not be null or 0 length");
        }
        if (payload == null || payload.length() == 0) {
            throw new JavametricsException("Payload must exist");
        }
        getTopic(topicName).sendJSON(payload);
    }
1092274
def auth(self, username, password):
        
        headers = {
            'Content-type': 'application/json'
        }
        payload = {
            'type': self.auth_type,
            'username': username,
            'password': password
        }
        try:
            full_url = utils.urljoin(self.host, '/api/v1/auth')
            response = requests.post(
                full_url,
                data=json.dumps(payload),
                headers=headers,
                verify=self.tls_verify
            )
        except RequestException:
            raise exceptions.TaigaRestException(
                full_url, 400,
                'NETWORK ERROR', 'POST'
            )
        if response.status_code != 200:
            raise exceptions.TaigaRestException(
                full_url,
                response.status_code,
                response.text,
                'POST'
            )
        self.token = response.json()['auth_token']
        self.raw_request = RequestMaker('/api/v1', self.host, self.token,
                                        'Bearer', self.tls_verify)
        self._init_resources()
1187617
def a_send_username(username, ctx):
    """"""
    if username:
        ctx.ctrl.sendline(username)
        return True
    else:
        ctx.ctrl.disconnect()
        raise ConnectionAuthenticationError("Username not provided", ctx.ctrl.hostname)
576504
public void identity_user_user_PUT(String user, String description, String email, String group) throws IOException {
		String qPath = "/me/identity/user/{user}";
		StringBuilder sb = path(qPath, user);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "description", description);
		addBody(o, "email", email);
		addBody(o, "group", group);
		exec(qPath, "PUT", sb.toString(), o);
	}
860036
def update(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.update, user, identity)
986540
def discharge_token(self, username):
        
        url = '{}discharge-token-for-user?username={}'.format(
            self.url, quote(username))
        logging.debug('Sending identity info to {}'.format(url))
        response = make_request(url, method='GET', timeout=self.timeout)
        try:
            macaroon = response['DischargeToken']
            json_macaroon = json.dumps(macaroon)
        except (KeyError, UnicodeDecodeError) as err:
            raise InvalidMacaroon(
                'Invalid macaroon from discharger: {}'.format(err.message))
        return base64.urlsafe_b64encode("[{}]".format(
            json_macaroon).encode('utf-8'))
451212
public void authenticateAndSignin(String username, String password) {
		logger.debug("authenticateAndSignin:" + username);

		Authentication request = new UsernamePasswordAuthenticationToken(username, password);
		Authentication result = authenticationManager.authenticate(request);
		SecurityContextHolder.getContext().setAuthentication(result);
	}
958221
@RequirePOST
    public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
        checkPermission(Jenkins.ADMINISTER);

        JSONObject json = req.getSubmittedForm();
        String oldFullName = this.fullName;
        fullName = json.getString("fullName");
        description = json.getString("description");

        List<UserProperty> props = new ArrayList<>();
        int i = 0;
        for (UserPropertyDescriptor d : UserProperty.all()) {
            UserProperty p = getProperty(d.clazz);

            JSONObject o = json.optJSONObject("userProperty" + (i++));
            if (o != null) {
                if (p != null) {
                    p = p.reconfigure(req, o);
                } else {
                    p = d.newInstance(req, o);
                }
                p.setUser(this);
            }

            if (p != null)
                props.add(p);
        }
        this.properties = props;

        save();

        if (oldFullName != null && !oldFullName.equals(this.fullName)) {
            UserDetailsCache.get().invalidate(oldFullName);
        }

        FormApply.success(".").generateResponse(req, rsp, this);
    }
1297783
public void setUserInfo(String username, String infoName, String value) throws CmsException {

        CmsUser user = m_cms.readUser(username);
        user.setAdditionalInfo(infoName, value);
        m_cms.writeUser(user);
    }
908149
@Post("json")
	public final Representation signUpUser(final Representation entity) {
		Request request = getRequest();
		Map<String, Object> requestAttributes = request.getAttributes();
		String passTypeIdentifier = (String) requestAttributes.get("passTypeIdentifier");
		String serialNumber = (String) requestAttributes.get("serialNumber");
		String authString = request.getChallengeResponse().getRawValue();

		LOGGER.debug("signUpUser: passTypeIdentifier: {}", passTypeIdentifier);
		LOGGER.debug("signUpUser: serialNumber: {}", serialNumber);
		LOGGER.debug("signUpUser - authString: {}", authString);

		Status responseStatus;
		Response response = getResponse();
		try {
			String payload = entity.getText();
			PKPersonalizePassPayload personalizePayload = jsonObjectMapper.readValue(payload, PKPersonalizePassPayload.class);

			LOGGER.debug("signUpUser - personalizePayload: {}", personalizePayload);
			responseStatus = handleSignUpUserRequest(passTypeIdentifier, serialNumber, authString, personalizePayload);
			if (responseStatus == Status.SUCCESS_OK || responseStatus == Status.SUCCESS_CREATED) {
				byte[] signedToken = signingUtil.signManifestFile(personalizePayload.getPersonalizationToken().getBytes(),
						getSingingInformation());
				InputRepresentation inputRepresentation = new InputRepresentation(new ByteArrayInputStream(signedToken));
				inputRepresentation.setMediaType(MediaType.APPLICATION_OCTET_STREAM);
				return inputRepresentation;
			}
		} catch (PKAuthTokenNotValidException e) {
			LOGGER.error("Error when processing signup request",e);
			responseStatus = Status.CLIENT_ERROR_UNAUTHORIZED;
		} catch (IOException | PKSigningException e) {
			LOGGER.error("Error when processing signup request",e);
			responseStatus = Status.SERVER_ERROR_INTERNAL;
		}
		response.setStatus(responseStatus);
		return null;

	}
585053
protected void doLoginByIdentity(Object userId, LoginSpecifiedOption option) throws LoginFailureException {
        assertUserIdRequired(userId);
        handleLoginSuccess(findLoginUser(userId).orElseThrow(() -> {
            String msg = "Not found the user by the user ID: " + userId + ", " + option;
            return handleLoginFailure(msg, userId, OptionalThing.of(option));
        }), option);
    }
383855
public void handleUpdateUser(String jsonp, String target,
            HttpServletRequest request,
            HttpServletResponse response, AuthenticationResult ar)
            throws IOException, ServletException {
        String update = request.getParameter("user");
        if (update == null || update.trim().length() == 0) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to get user information."));
            return;
        }
        try {
            User newUser = m_mapper.readValue(update, User.class);
            if (newUser == null) {
                response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to parse user information."));
                return;
            }

            DeploymentType newDeployment = CatalogUtil.getDeployment(new ByteArrayInputStream(getDeploymentBytes()));
            User user = null;
            String[] splitTarget = target.split("/");
            if (splitTarget.length == 3) {
                user = findUser(splitTarget[2], newDeployment);
            }
            if (user == null) {
                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "User not found"));
                return;
            }
            user.setName(newUser.getName());
            user.setPassword(newUser.getPassword());
            user.setPlaintext(newUser.isPlaintext());
            user.setRoles(newUser.getRoles());

            String dep = CatalogUtil.getDeployment(newDeployment);
            if (dep == null || dep.trim().length() <= 0) {
                response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to build deployment information."));
                return;
            }
            Object[] params = new Object[]{null, dep};
            //Call sync as nothing else can happen when this is going on.
            SyncCallback cb = new SyncCallback();
            httpClientInterface.callProcedure(request.getRemoteHost(), ar, BatchTimeoutOverrideType.NO_TIMEOUT, cb, "@UpdateApplicationCatalog", params);
            cb.waitForResponse();
            ClientResponseImpl r = ClientResponseImpl.class.cast(cb.getResponse());
            if (r.getStatus() == ClientResponse.SUCCESS) {
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.SUCCESS, "User Updated."));
            } else {
                response.getWriter().print(HTTPClientInterface.asJsonp(jsonp, r.toJSONString()));
            }

        } catch (Exception ex) {
            m_log.error("Failed to update user from API", ex);
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, Throwables.getStackTraceAsString(ex)));
        }
    }
90986
public void doLogin(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        if (!common.checkPost(request, response)) return;

        String username = request.getParameter("username");
        if (username == null) {
            response.sendError(400, "Missing field \"username\".");
            return;
        }

        String usernameError = checkUsername(username);
        if (usernameError != null) {
            response.sendError(400, "Invalid username: " + usernameError);
            return;
        }

        // Lookup user.  If the user doesn't exist, create it.
        User user;
        synchronized (common.userDb) {
            user = common.userDb.get(username);
            if (user == null) {
                user = new User();
                user.username = username;
                user.dropboxAccessToken = null;

                common.userDb.put(user.username, user);
                common.saveUserDb();
            }
        }

        request.getSession().setAttribute("logged-in-username", user.username);
        response.sendRedirect("/");
    }
342126
function addUser(username) {
		return userProject.findOne({'username': username}).exec()
		.then(function(doc) {
			if (!doc) {
				return userProject.create(userProjectJSON(username));
			}
			return Promise.resolve(doc);
		});
	}
955349
private void writeName(String name) throws JSONException {

// If this name has already been registered, then emit its integer and
// increment its usage count.

        Kim kim = new Kim(name);
        int integer = this.namekeep.find(kim);
        if (integer != none) {
            one();
            write(integer, this.namekeep);
        } else {

// Otherwise, emit the string with Huffman encoding, and register it.

            zero();
            write(kim, this.namehuff, this.namehuffext);
            write(end, namehuff);
            this.namekeep.register(kim);
        }
    }
1324258
@SuppressWarnings("unchecked")
    public void handleLoginResult(Map<String, Object> jsonFields) {
        if (jsonFields.containsKey("result")) {
            Map<String, Object> result = (Map<String, Object>) jsonFields
                    .get(DdpMessageField.RESULT);
            mResumeToken = (String) result.get("token");
            saveResumeToken(mResumeToken);
            mUserId = (String) result.get("id");
            mDDPState = DDPSTATE.LoggedIn;
            broadcastConnectionState(mDDPState);
        } else if (jsonFields.containsKey("error")) {
            Map<String, Object> error = (Map<String, Object>) jsonFields
                    .get(DdpMessageField.ERROR);
            broadcastDDPError((String) error.get("message"));
        }
    }