bambou/session.go
func (s *Session) makeAuthorizationHeaders() (string, *Error) {

	if s.Username == "" {
		return "", NewBambouError("Invalid Credentials", "No username given")
	}

	if s.root == nil {
		return "", NewBambouError("Invalid Credentials", "No root user set")
	}

	key := s.root.APIKey()
	if s.Password == "" && key == "" {
		return "", NewBambouError("Invalid Credentials", "No password or authentication token given")
	}

	if key == "" {
		key = s.Password
	}

	return "XREST " + base64.StdEncoding.EncodeToString([]byte(s.Username+":"+key)), nil
}
func (s *Session) makeAuthorizationHeaders() (string, *Error) {

	if s.Username == "" {
		return "", NewBambouError("Invalid Credentials", "No username given")
	}

	if s.root == nil {
		return "", NewBambouError("Invalid Credentials", "No root user set")
	}

	key := s.root.APIKey()
	if s.Password == "" && key == "" {
		return "", NewBambouError("Invalid Credentials", "No password or authentication token given")
	}

	if key == "" {
		key = s.Password
	}

	return "XREST " + base64.StdEncoding.EncodeToString([]byte(s.Username+":"+key)), nil
}
func ( s * Session ) makeAuthorizationHeaders ( ) ( string , * Error ) { if s . Username == " " { return " " , NewBambouError ( " " , " " ) } if s . root == nil { return " " , NewBambouError ( " " , " " ) } key := s . root . APIKey ( ) if s . Password == " " && key == " " { return " " , NewBambouError ( " " , " " ) } if key == " " { key = s . Password } return " " + base64 . StdEncoding . EncodeToString ( [ ] byte ( s . Username + " " + key ) ) , nil }
// Used for user & password based authentication
Used for user & password based authentication