package com.sy.coinage.core.util;

import java.util.UUID;

import org.apache.commons.lang3.StringUtils;

import com.google.common.primitives.UnsignedLongs;

/**
 * -生成token工具类
 *
 * @return
 */
public class GenerateTGT {

    public static String generateToken() {
        UUID uuid = UUID.randomUUID();
        String s1 = UnsignedLongs.toString(uuid.getMostSignificantBits(), 36)
                        + UnsignedLongs.toString(uuid.getLeastSignificantBits(), 36);
        s1 = StringUtils.rightPad(s1, 27, "0");
        return new StringBuilder("TGT").append(s1).toString().toUpperCase();
    }

    public static String generateAuth() {
        UUID uuid = UUID.randomUUID();
        String s1 = UnsignedLongs.toString(uuid.getMostSignificantBits(), 36)
                        + UnsignedLongs.toString(uuid.getLeastSignificantBits(), 36);
        s1 = StringUtils.rightPad(s1, 27, "0");
        return new StringBuilder("AC").append(s1).toString().toUpperCase();
    }

}
