Create a new access token that is valid from now on for an infinite amount
of time.

@param sTokenString
The existing token string. May be <code>null</code> in which case a
new token string is created.
@return Never <code>null</code>.
338973
@Nonnull
  public static AccessToken createAccessTokenValidFromNow (@Nullable final String sTokenString)
  {
    // Length 66 so that the Base64 encoding does not add the "==" signs
    // Length must be dividable by 3
    final String sRealTokenString = StringHelper.hasText (sTokenString) ? sTokenString : createNewTokenString (66);
    return new AccessToken (sRealTokenString, PDTFactory.getCurrentLocalDateTime (), null, new RevocationStatus ());
  }
430626
protected CommonToken createToken(CommonToken prototype, String text, 
			Integer charPosInLine, Integer channel, Integer start, Integer stop, Integer type) {
		if (prototype == null)
			throw new IllegalArgumentException("Prototype may not be null.");
		CommonToken result = new CommonToken(prototype);
		if (text != null)
			result.setText(text);
		if (charPosInLine != null)
			result.setCharPositionInLine(charPosInLine.intValue());
		if (channel != null)
			result.setChannel(channel.intValue());
		if (start != null)
			result.setStartIndex(start.intValue());
		if (stop != null)
			result.setStopIndex(stop.intValue());
		if (type != null)
			result.setType(type.intValue());
		return result;
	}
620995
public String getToken() {
        if (isNull()){
            return NullOidToken;
        }
        StringBuilder res = new StringBuilder();
        res.append(_type.getToken()).append(SEPARATOR).append(_id);
        if (hasMoment()) {
            res.append(SEPARATOR).append(_moment);
        }
        return res.toString();
    }
732469
@Override
    public JsonToken nextToken() throws IOException
    {
        if (_nextToken != null) {
            _currToken = _nextToken;
            _nextToken = null;
            return _currToken;
        }
        // are we to descend to a container child?
        if (_startContainer) {
            _startContainer = false;
            // minor optimization: empty containers can be skipped
            if (!_nodeCursor.currentHasChildren()) {
                _currToken = (_currToken == JsonToken.START_OBJECT) ?
                    JsonToken.END_OBJECT : JsonToken.END_ARRAY;
                return _currToken;
            }
            _nodeCursor = _nodeCursor.iterateChildren();
            _currToken = _nodeCursor.nextToken();
            if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
                _startContainer = true;
            }
            return _currToken;
        }
        // No more content?
        if (_nodeCursor == null) {
            _closed = true; // if not already set
            return null;
        }
        // Otherwise, next entry from current cursor
        _currToken = _nodeCursor.nextToken();
        if (_currToken != null) {
            if (_currToken == JsonToken.START_OBJECT || _currToken == JsonToken.START_ARRAY) {
                _startContainer = true;
            }
            return _currToken;
        }
        // null means no more children; need to return end marker
        _currToken = _nodeCursor.endToken();
        _nodeCursor = _nodeCursor.getParent();
        return _currToken;
    }
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);
		}
	}
533057
public TokenRequestBuilder getTokenEndPoint() {
        for (Authentication apiAuth : authentications.values()) {
            if (apiAuth instanceof RetryingOAuth) {
                RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth;
                return retryingOAuth.getTokenRequestBuilder();
            }
        }
        return null;
    }
326710
public static CreateResult create(String accessToken, Create<?> card) {
		return create(accessToken, JsonUtil.toJSONString(card));
	}
1055222
public String auth_createToken()
    throws FacebookException, IOException {
    T d = this.callMethod(FacebookMethod.AUTH_CREATE_TOKEN);
    return extractString(d);
  }
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());
    }
359553
private String createDebugTxnID() {
        if (LOG.isDebugEnabled()) {
            // Not required to be unique, just a best effort id here.
            return (Integer.toString(hashCode()) + Long.toString(System.currentTimeMillis()));
        }
        return null;
    }
701568
public String createToken(CmsObject cms) throws CmsException {

        CmsUser user = cms.getRequestContext().getCurrentUser();
        String key = RandomStringUtils.randomAlphanumeric(16);
        Token tokenObj = new Token(user.getName(), key);
        String token = tokenObj.encode();
        String addInfoKey = tokenObj.getAdditionalInfoKey();
        String value = "" + (System.currentTimeMillis() + m_lifetime);
        user.getAdditionalInfo().put(addInfoKey, value);
        removeExpiredTokens(user, System.currentTimeMillis());
        LOG.info("Generated token for user " + user.getName() + " using key " + key);
        m_adminCms.writeUser(user);

        return token;
    }
617329
@Nonnull
  public static AuthIdentificationResult validateLoginCredentialsAndCreateToken (@Nonnull final IAuthCredentials aCredentials)
  {
    ValueEnforcer.notNull (aCredentials, "Credentials");

    // validate credentials
    final ICredentialValidationResult aValidationResult = AuthCredentialValidatorManager.validateCredentials (aCredentials);
    if (aValidationResult.isFailure ())
    {
      if (LOGGER.isWarnEnabled ())
        LOGGER.warn ("Credentials have been rejected: " + aCredentials);
      return AuthIdentificationResult.createFailure (aValidationResult);
    }

    if (LOGGER.isDebugEnabled ())
      LOGGER.debug ("Credentials have been accepted: " + aCredentials);

    // try to get AuthSubject from passed credentials
    final IAuthSubject aSubject = AuthCredentialToSubjectResolverManager.getSubjectFromCredentials (aCredentials);
    if (aSubject != null)
    {
      if (LOGGER.isDebugEnabled ())
        LOGGER.debug ("Credentials " + aCredentials + " correspond to subject " + aSubject);
    }
    else
    {
      if (LOGGER.isErrorEnabled ())
        LOGGER.error ("Failed to resolve credentials " + aCredentials + " to an auth subject!");
    }

    // Create the identification element
    final AuthIdentification aIdentification = new AuthIdentification (aSubject);

    // create the token (without expiration seconds)
    final IAuthToken aNewAuthToken = AuthTokenRegistry.createToken (aIdentification,
                                                                    IAuthToken.EXPIRATION_SECONDS_INFINITE);
    return AuthIdentificationResult.createSuccess (aNewAuthToken);
  }
1270718
public static String accessToken(String key) {
		if (isKeyParam(key)) {
			String[] keys = key.split(KEY_JOIN);
			if (keys.length == 2) {
				return apiHandler.accessToken(keys[0], keys[1]);
			} else if (keys.length == 1) {
				return apiHandler.accessToken(keys[0]);
			}
		}
		return key;
	}
108209
public ComponentDto createWithoutCommit(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) {
    checkKeyFormat(newComponent.qualifier(), newComponent.key());
    ComponentDto componentDto = createRootComponent(dbSession, newComponent);
    if (isRootProject(componentDto)) {
      createMainBranch(dbSession, componentDto.uuid());
    }
    removeDuplicatedProjects(dbSession, componentDto.getDbKey());
    handlePermissionTemplate(dbSession, componentDto, userId);
    return componentDto;
  }
497812
public String createToken(final Map<String, Object> claims) {
        final JwtBuilder jwtBuilder = Jwts.builder();
        jwtBuilder.setClaims(claims);
        return jwtBuilder.signWith(SignatureAlgorithm.HS256, key).compact();
    }
605746
public Token<DelegationTokenIdentifier> createDelegationToken(String renewer) throws IOException {
    Text renewerText = new Text();
    if (renewer != null) {
      renewerText.set(renewer);
    }

    DelegationTokenIdentifier tokenIdentifier =
        requireNonNull(createTokenIdentifier(renewerText), "Token identifier");

    Token<DelegationTokenIdentifier> token = new Token<>(tokenIdentifier, secretManager);
    token.setKind(getKind());
    token.setService(service);
    logger.atFine().log("Created token %s with token identifier %s", token, tokenIdentifier);
    return token;
  }
573409
@Transactional
    @Override
    public OAuthAuthorizationCode create(OAuthAuthorizationCode authCodeEntity) {
        requireNotDisposed();
        requireArgument(StringUtils.isNotBlank(authCodeEntity.getAuthorizationCode()), "authorization_code cannot be null or empty");
        requireArgument(StringUtils.isNotBlank(authCodeEntity.getState()), "state cannot be null or empty");
        requireArgument(StringUtils.isNotBlank(authCodeEntity.getRedirectUri()), "Redirect URI cannot be null or empty");
        requireArgument(authCodeEntity != null, "Cannot update a null authorization code entity");
        EntityManager em = emf.get();
        OAuthAuthorizationCode result = em.merge(authCodeEntity);
        em.flush();
        _logger.debug("Created OAuthAuthorizationCode to : {}", result);
        return result;
    }