It is legal to throw the ball off the backboard as a pass to yourself.  The only time it is illegal is when attempting a free throw.  While attempting a free throw the ball must hit the rim as well.