示例#1
0
// Generate a security token.
//
// This uses SecurityTokenLength to determine the appropriate length. If
// that value is <= 0, this will panic.
func SecurityToken() string {
	tok, err := goutils.RandomAlphaNumeric(SecurityTokenLength)
	if err != nil {
		// We panic because the only way to error out here is to pass in an
		// illegal security token length.
		panic(err)
	}
	return tok
}
示例#2
0
func genName(pname string) string {
	s, _ := goutils.RandomAlphaNumeric(8)
	return fmt.Sprintf("%s-%s", pname, s)
}