func (l AmRestful) getPrivilegePwd(request *restful.Request, response *restful.Response) *privilegePwd {
	var privilegePwd privilegePwd
	err := request.ReadEntity(&privilegePwd)
	if err == nil {
		err = am.IsValidPrivilege(privilegePwd.Privilege)
	}
	if err != nil {
		l.setError(response, http.StatusBadRequest, err)
		return nil
	}
	return &privilegePwd
}
/* old use
func (l AmRestful) getPwd(request *restful.Request, response *restful.Response) *secretData {
var pwd secretData

err := request.ReadEntity(&pwd)
if err != nil {
l.setError(response, http.StatusBadRequest, err)
return nil
}
return &pwd
}
package accountsRestful
import (
	"encoding/json"
	"fmt"
	"net/http"
	"strings"
	"time"
	"github.com/emicklei/go-restful"
	am "github.com/ibm-security-innovation/libsecurity-go/accounts"
	app "github.com/ibm-security-innovation/libsecurity-go/app/token"
	defs "github.com/ibm-security-innovation/libsecurity-go/defs"
	logger "github.com/ibm-security-innovation/libsecurity-go/logger"
	"github.com/ibm-security-innovation/libsecurity-go/password"
	cr "github.com/ibm-security-innovation/libsecurity-go/restful/common-restful"
	"github.com/ibm-security-innovation/libsecurity-go/restful/libsecurity-restful"
	"github.com/ibm-security-innovation/libsecurity-go/salt"
)
const (
	amPrefix        = "/account-manager"
	userPath        = "/user"
	usersPath       = "/users"
	verifyPath      = "/verify"
	logoutPath      = "/logout"
	pwdPath         = "password"
	privilegePath   = "privilege"
	userIDParam     = "user-name"
	userNameComment = "user name"
	saltLen int = 20
	cookieExpirationDurationMinutes = 30
)
var (
	servicePath           string  
	checkPasswordStrength = true  
)
type AmRestful struct {
	st *libsecurityRestful.LibsecurityRestful
}
type secretData struct {
	Password string
}
type userData struct {
	Name     string
	Password []byte
}
type pUserData struct {
	Name     string
	Password string
}
type privilegePwd struct {
	Password  string
	Privilege string
}
type privilegeInfo struct {
	Privilege string
}
func NewAmRestful() *AmRestful {
	return &AmRestful{}
}
func init() {
	initCommandToPath()
}
func (l *AmRestful) SetData(stR *libsecurityRestful.LibsecurityRestful) {
	l.st = stR
}
func (l AmRestful) getURLPath(request *restful.Request, name string) cr.URL {
	return cr.URL{URL: fmt.Sprintf("%v/%v", servicePath, name)}
}
func (l AmRestful) setError(response *restful.Response, httpStatusCode int, err error) {
	data, _ := json.Marshal(cr.Error{Code: httpStatusCode, Message: fmt.Sprintf("%v", err)})
	logger.Error.Printf("Set Error code: %v, error: %v", httpStatusCode, err)
	response.WriteErrorString(httpStatusCode, string(data))
}
func (l AmRestful) getPrivilege(request *restful.Request, response *restful.Response) *privilegeInfo {
	var privilege privilegeInfo
	err := request.ReadEntity(&privilege)
	if err == nil {
		err = am.IsValidPrivilege(privilege.Privilege)
	}
	if err != nil {
		l.setError(response, http.StatusBadRequest, err)
		return nil
	}
	return &privilege
}