//WaitAuthenticationToken block the current thread waiting for a token coming from authentication flow
// parameters:
//		pTimeout timeout interval
// returns:
//		vRisAuthenticationToken authenticationToken generated. In case of errors, is not valid and contains in the field AuthenticationToken.Error the cause
//		vRisError nil in case of authentication succeded otherwise the error occurred
WaitAuthenticationToken block the current thread waiting for a token coming from authentication flow
parameters:
pTimeout timeout interval
returns:
vRisAuthenticationToken authenticationToken generated. In case of errors, is not valid and contains in the field AuthenticationToken.Error the cause
vRisError nil in case of authentication succeded otherwise the error occurred
// WaitAuthenticationToken block the current thread waiting for a token coming from authentication flow // parameters : // pTimeout timeout interval // returns : // vRisAuthenticationToken authenticationToken generated . In case of errors is not valid and contains in the field AuthenticationToken . Error the cause // vRisError nil in case of authentication succeded otherwise the error occurred
func (vSelf *HttpAuthHelper) WaitAuthenticationToken(pTimeout time.Duration) (vRisAuthenticationToken *AuthenticationToken, vRisError error) {
	log.Printf("Requested authentication, open a browser to the following url to continue: http://%s", vSelf.address)
	vTokenChannel := make(chan *AuthenticationToken)
	vSelf.SetAuthenticationHandler(func(pAuthenticationToken *AuthenticationToken, pApplicationInfo ApplicationInfo) {
		vTokenChannel <- pAuthenticationToken
	})
	select {
	case vToken := <-vTokenChannel:
		return vToken, vToken.Error
	case <-time.After(pTimeout):
		vError := diagnostic.NewError("timeout expired waiting for authentication", nil)
		return newAuthenticationTokenError(vError), vError
	}
}
func ( vSelf * HttpAuthHelper ) WaitAuthenticationToken ( pTimeout time . Duration ) ( vRisAuthenticationToken * AuthenticationToken , vRisError error ) { log . Printf ( " " , vSelf . address ) vTokenChannel := make ( chan * AuthenticationToken ) vSelf . SetAuthenticationHandler ( func ( pAuthenticationToken * AuthenticationToken , pApplicationInfo ApplicationInfo ) { vTokenChannel <- pAuthenticationToken } ) select { case vToken := <- vTokenChannel : return vToken , vToken . Error case <- time . After ( pTimeout ) : vError := diagnostic . NewError ( " " , nil ) return newAuthenticationTokenError ( vError ) , vError } }
WaitAuthenticationToken block the current thread waiting for a token coming from authentication flow
parameters:
pTimeout timeout interval
returns:
vRisAuthenticationToken authenticationToken generated.
WaitAuthenticationToken block the current thread waiting for a token coming from authentication flow parameters : pTimeout timeout interval returns : vRisAuthenticationToken authenticationToken generated .