func (c *AuthCnfg) SetAuth(req *http.Request, httpClient *gosip.SPClient) error {
	authCookie, _, err := c.GetAuth()
	if err != nil {
		return err
	}
	req.Header.Set("Cookie", authCookie)
	return nil
}
SetAuth : authenticate request
noinspection GoUnusedParameter
package saml
import (
	"encoding/json"
	"io/ioutil"
	"net/http"
	"os"
	"github.com/koltyakov/gosip"
	"github.com/koltyakov/gosip/cpass"
)
type AuthCnfg struct {
	SiteURL  string `json:"siteUrl"`   
	Username string `json:"username"`  
	Password string `json:"password"`  
	masterKey string
	client    *http.Client
}
func (c *AuthCnfg) ReadConfig(privateFile string) error {
	jsonFile, err := os.Open(privateFile)
	if err != nil {
		return err
	}
	defer func() { _ = jsonFile.Close() }()
	byteValue, _ := ioutil.ReadAll(jsonFile)
	return c.ParseConfig(byteValue)
}
func (c *AuthCnfg) ParseConfig(byteValue []byte) error {
	if err := json.Unmarshal(byteValue, &c); err != nil {
		return err
	}
	crypt := cpass.Cpass(c.masterKey)
	pass, err := crypt.Decode(c.Password)
	if err == nil {
		c.Password = pass
	}
	return nil
}
func (c *AuthCnfg) WriteConfig(privateFile string) error {
	crypt := cpass.Cpass(c.masterKey)
	pass, err := crypt.Encode(c.Password)
	if err != nil {
		pass = c.Password
	}
	config := &AuthCnfg{
		SiteURL:  c.SiteURL,
		Username: c.Username,
		Password: pass,
	}
	file, _ := json.MarshalIndent(config, "", "  ")
	return ioutil.WriteFile(privateFile, file, 0644)
}
func (c *AuthCnfg) SetMasterkey(masterKey string) { c.masterKey = masterKey }
func (c *AuthCnfg) GetAuth() (string, int64, error) { return GetAuth(c) }
func (c *AuthCnfg) GetSiteURL() string { return c.SiteURL }
func (c *AuthCnfg) GetStrategy() string { return "saml" }