// Authenticate ClientID/Password to the CHAVPN authentication framework.
// It returns nil on success, error if there's an error.
Authenticate ClientID/Password to the CHAVPN authentication framework.
It returns nil on success, error if there's an error.
// Authenticate ClientID / Password to the CHAVPN authentication framework . // It returns nil on success error if there ' s an error .
func (auth *Authenticator) Authenticate(clientID, password string) error {
	if clientID == "" || password == "" {
		return ErrUser
	}
	if auth == nil {
		auth = new(Authenticator)
	}
	if auth.AuthURL == "" {
		auth.AuthURL = defaultAuthURL
	}
	if auth.PostHeadersTemplate == "" {
		auth.PostHeadersTemplate = postHeadersTemplate
	}
	if auth.HTTPClientFactory == nil {
		auth.HTTPClientFactory = defaultHTTPClientFactory
	}
	redirURL, token, err := auth.getToken()
	if err != nil {
		return err
	}
	signURL, err := auth.getSignedToken(redirURL, token, clientID, password)
	if err != nil {
		return err
	}
	return auth.callAuthenticator(signURL)
}
func ( auth * Authenticator ) Authenticate ( clientID , password string ) error { if clientID == " " || password == " " { return ErrUser } if auth == nil { auth = new ( Authenticator ) } if auth . AuthURL == " " { auth . AuthURL = defaultAuthURL } if auth . PostHeadersTemplate == " " { auth . PostHeadersTemplate = postHeadersTemplate } if auth . HTTPClientFactory == nil { auth . HTTPClientFactory = defaultHTTPClientFactory } redirURL , token , err := auth . getToken ( ) if err != nil { return err } signURL , err := auth . getSignedToken ( redirURL , token , clientID , password ) if err != nil { return err } return auth . callAuthenticator ( signURL ) }
Authenticate ClientID/Password to the CHAVPN authentication framework.
Authenticate ClientID / Password to the CHAVPN authentication framework .