func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)
	privateKeyFilePath := flag.String("rsa-private", "./dist/key.private", "RSA private key file path")
	secureKeyFilePath := flag.String("secure-key", "./dist/secureKey", "password to encrypt the secure storage")
	usersDataPath := flag.String("data-file", "./dist/data.txt", "Login information file")
	flag.Parse()

	ServicePath = cr.ServicePathPrefix + cr.Version + AmPrefix
	resourcePath = listener + ServicePath + UsersPath

	usersList := en.New()
	signKey, verifyKey := app.TokenSetUp(*privateKeyFilePath)
	loginKey := ss.GetSecureKey(*secureKeyFilePath)
	en.LoadInfo(*usersDataPath, loginKey, usersList)

	stRestful = libsecurity_restful.NewLibsecurityRestful()
	stRestful.SetData(usersList, loginKey, verifyKey, signKey, nil)

	rootCookieStr, _ := app.GenerateToken(stc.RootUserName, am.SuperUserPermission, clientIP, signKey)
	cr.SetCookie(rootCookieStr)

	for _, name := range usersName {
		stRestful.UsersList.AddUser(name)
	}

	go runServer()
	time.Sleep(100 * time.Millisecond)
}
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)

	usersList := en.NewEntityManager()
	stRestful = libsecurity_restful.NewLibsecurityRestful()
	stRestful.SetData(usersList, nil, nil, nil, nil)
	stRestful.SetToFilterFlag(false)

	ServicePath = cr.ServicePathPrefix + cr.Version + AclPrefix
	resourcePath = listener + ServicePath

	go runServer()
	time.Sleep(100 * time.Millisecond)
}
Example #3
0
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, os.Stdout, os.Stderr)
	stc.Serializers[stc.OcraPropertyName] = &Serializer{}

	for _, val := range ocraValidOutputLength {
		ocraValidOutputLengthMap[val] = val
	}
	ocraSuiteDataInputParseStruct = []parseData{{ocraSuiteDataInputCounterToken, checkOcraDataInputCounterValidity, handleCounter, dataInputCounterRegExp},
		{ocraSuiteDataInputQuestionToken, checkOcraDataInputQuestionValidity, handleQuestion, dataInputQuestionRegExp},
		{ocraSuiteDataInputPasswordToken, checkOcraDataInputPasswordValidity, handlePassword, dataInputPasswordTokenRegExp},
		{ocraSuiteDataInputSessionToken, checkOcraDataInputSessionValidity, handleSession, dataInputSessionTokenRegExp},
		{ocraSuiteDataInputTimeStampToken, checkOcraDataInputTimeStampValidity, handleTimeStamp, dataInputTimeStampTokenRegExp}}
	for _, c := range ocraSuiteDataInputParseStruct {
		ocraSuiteDataInputValidTokensMap[c.token[0]] = c
	}
}
// This example show the following:
// - Discard Trace messages
// - Write Info messages to stdout
// - Write Warning to stdout and log file
// - Write Error to stderr and log file
func Example_logger() {
	fileName := "log-file.txt"
	os.Remove(fileName)
	file, err := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
	if err != nil {
		log.Fatalln("Failed to open log file", fileName, ":", err)
	}

	multiW := io.MultiWriter(file, os.Stdout)
	multiE := io.MultiWriter(file, os.Stderr)
	logger.Init(ioutil.Discard, os.Stdout, multiW, multiE)

	logger.Trace.Println("Example: I have something standard to say")
	logger.Info.Println("Example: Special Information")
	logger.Warning.Println("Example: There is something you need to know about")
	logger.Error.Println("Example: Something has failed")
}
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)

	ServicePath = cr.ServicePathPrefix + cr.Version + SsPrefix
	resourcePath = listener + ServicePath + StoragePath
	itemPath = listener + ServicePath + StorageItemPath

	baseHeaderInfo[secretIdParam] = secretCode

	usersList := en.NewEntityManager()
	stRestful = libsecurity_restful.NewLibsecurityRestful()
	secureStorage, _ := ss.NewStorage([]byte(secretCode))
	stRestful.SetData(usersList, nil, nil, nil, secureStorage)
	stRestful.SetToFilterFlag(false)

	go runServer()
	time.Sleep(100 * time.Millisecond)
}
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)

	EnServicePath = cr.ServicePathPrefix + cr.Version + UmPrefix
	enResourcePath = listener + EnServicePath
	enUserResourcePath = listener + EnServicePath + UsersPath
	UsersServicePath = EnServicePath + UsersPath
	ResourceServicePath = EnServicePath + ResourcesPath
	enPath = listener + EnServicePath

	usersList := en.New()

	stRestful = libsecurity_restful.NewLibsecurityRestful()
	stRestful.SetData(usersList, nil, nil, nil, nil)
	stRestful.SetToFilterFlag(false)

	go runServer()
	time.Sleep(100 * time.Millisecond)
}
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)

	ServicePath = cr.ServicePathPrefix + cr.Version + OcraPrefix
	resourcePath = listener + ServicePath + usersPath

	usersList := en.New()

	stRestful = libsecurity_restful.NewLibsecurityRestful()
	stRestful.SetData(usersList, nil, nil, nil, nil)
	stRestful.SetToFilterFlag(false)

	for _, name := range usersName {
		stRestful.UsersList.AddUser(name)
	}

	go runServer()
	time.Sleep(100 * time.Millisecond)
}
Example #8
0
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, ioutil.Discard, ioutil.Discard)
}
func (u *AmUserInfo) setLogger(severity string, fileName string) {
	logger.Init(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr)
}
Example #10
0
func init() {
	logger.Init(ioutil.Discard, ioutil.Discard, os.Stdout, os.Stderr)
	stc.Serializers[stc.AclPropertyName] = &Serializer{}

	en.RemoveEntityFromAcl = RemoveEntityFromAcl
}