Create one time token account.

@param username the username
@return the one time token account
341793
public OneTimeTokenAccount create(final String username) {
        val key = getGoogleAuthenticator().createCredentials();
        return new GoogleAuthenticatorAccount(username, key.getKey(), key.getVerificationCode(), key.getScratchCodes());
    }
704554
public JwtToken build(JwtAuth userDetails) {
        Date expireTime = generateExpirationDate();
        Map<String, Object> claims = new HashMap<>(16);
        claims.put(CLAIM_KEY_LOGIN_NAME, userDetails.getLoginName());
        claims.put(CLAIM_KEY_ID, userDetails.getId());
        claims.put(CLAIM_KEY_MICK_NAME, userDetails.getNickName());
        claims.put(CLAIM_KEY_CREATED, expireTime.getTime());
        claims.put(CLAIM_KEY_ROLE, userDetails.getRoles());
        claims.put(CLAIM_KEY_AVATAR,userDetails.getAvatar());
        return new JwtToken(build(claims, expireTime), expireTime.getTime());
    }
417138
public static AuthenticationData createAuthenticationData(String userName, UserRegistry userRegistry) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, CLASS_NAME + "createAuthenticationData", userName);
        }
        AuthenticationData authData = new WSAuthenticationData();
        if (userName == null) {
            userName = "";
        }
        String realm = getDefaultRealm(userRegistry);
        authData.set(AuthenticationData.USERNAME, userName);
        authData.set(AuthenticationData.REALM, realm);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, CLASS_NAME + "createAuthenticationData", authData);
        }
        return authData;
    }
255378
def users_create_token(self, user_id=None, username=None, **kwargs):
        """"""
        if user_id:
            return self.__call_api_post('users.createToken', userId=user_id, kwargs=kwargs)
        elif username:
            return self.__call_api_post('users.createToken', username=username, kwargs=kwargs)
        else:
            raise RocketMissingParamException('userID or username required')
433417
public JwtToken refreshToken(String token) {
        String refreshedToken;
        Date expireTime = generateExpirationDate();
        try {
            final Claims claims = getClaimsFromToken(token);
            claims.put(CLAIM_KEY_CREATED, expireTime.getTime());
            refreshedToken = build(claims, expireTime);
        } catch (Exception e) {
            log.error("refreshedToken jwt token error : {}", e.getMessage());
            refreshedToken = null;
        }
        return new JwtToken(refreshedToken, expireTime.getTime());
    }
259137
@POST
  @Path("/db/{authorizerName}/users/{userName}")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  @ResourceFilters(BasicSecurityResourceFilter.class)
  public Response createUser(
      @Context HttpServletRequest req,
      @PathParam("authorizerName") final String authorizerName,
      @PathParam("userName") String userName
  )
  {
    return resourceHandler.createUser(authorizerName, userName);
  }
974204
public static UsernameAttribute createUsernameAttribute(String username) {
		UsernameAttribute attribute = new UsernameAttribute();

		try {
			attribute.setUsername(username.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException ueex) {
			throw new UndeclaredThrowableException(ueex);
		}
		return attribute;
	}
1055222
public String auth_createToken()
    throws FacebookException, IOException {
    T d = this.callMethod(FacebookMethod.AUTH_CREATE_TOKEN);
    return extractString(d);
  }
1352365
private Auth constructAuth(String authToken, String tokenSecret, String username) throws IOException {

        Auth auth = new Auth();
        auth.setToken(authToken);
        auth.setTokenSecret(tokenSecret);

        // Prompt to ask what permission is needed: read, update or delete.
        auth.setPermission(Permission.fromString("delete"));

        User user = new User();
        // Later change the following 3. Either ask user to pass on command line or read
        // from saved file.
        user.setId(nsid);
        user.setUsername((username));
        user.setRealName("");
        auth.setUser(user);
        this.authStore.store(auth);
        return auth;
    }
773028
public CompletionStage<Token> login(final String username,
            final String password, final AuthModule eauth) {
        Map<String, String> props = new LinkedHashMap<>();
        props.put("username", username);
        props.put("password", password);
        props.put("eauth", eauth.getValue());

        String payload = gson.toJson(props);

        CompletionStage<Token> result = asyncHttpClient
                .post(uri.resolve("login"), payload, JsonParser.TOKEN)
                .thenApply(r -> {
                    // They return a list of tokens here, take the first one
                    Token token = r.getResult().get(0);
                    return token;
                });

        return result;
    }
15040
public CouchDbGoogleAuthenticatorAccount update(final OneTimeTokenAccount account) {
        setId(account.getId());
        setUsername(account.getUsername());
        setSecretKey(account.getSecretKey());
        setValidationCode(account.getValidationCode());
        setScratchCodes(account.getScratchCodes());
        setRegistrationDate(account.getRegistrationDate());
        return this;
    }
454718
public static UsernameAttribute createUsernameAttribute(byte username[]) {
		UsernameAttribute attribute = new UsernameAttribute();

		attribute.setUsername(username);
		return attribute;
	}
207693
public static String put(String username, final int seconds) {
        String key = UUID.randomUUID().toString();
        cache.setex(key, seconds, username);
        return key;
    }
276137
@ReadOperation
    public YubiKeyAccount get(@Selector final String username) {
        val result = registry.getAccount(username);
        return result.orElse(null);
    }
641959
protected function setUsernameToken($username, $usernameId = null)
    {
        $usernameToken = new UsernameToken($usernameId);
        $usernameToken->setUsername(new Username($username));
        $this->security->setUsernameToken($usernameToken);

        return $this;
    }
531314
private MongoCredential createCredentail(String userName, String database, String password) {
		if (StrUtil.hasEmpty(userName, database, database)) {
			return null;
		}
		return MongoCredential.createCredential(userName, database, password.toCharArray());
	}
88132
public static void createToken(Controller controller, String tokenName, int secondsOfTimeOut) {
		if (tokenCache == null) {
			String tokenId = String.valueOf(random.nextLong());
			controller.setAttr(tokenName, tokenId);
			controller.setSessionAttr(tokenName, tokenId);
			createTokenHiddenField(controller, tokenName, tokenId);
		}
		else {
			createTokenUseTokenIdGenerator(controller, tokenName, secondsOfTimeOut);
		}
	}