I think this online ESRI example is a good start.
My will is not to have the user prompted for EACH mapservice authentication because I already know that ALL of the mapservices belong to her/him and therefore are accessible by her/him under the same username&password. In my idea, the prompt for credentials should appear just ONCE and therefore the JS code should feed credentials to each of the mapservice via some sort of RESTful login call. To me it doesn't seem like the ArcGIS Server REST API is providing such a call...maybe I am wrong.
Is therefore this "RESTful" way to login to secured mapservices feasible with ArcGIS Server (making it possible to access secured services programmatically)? If so, can any of you provide examples or links to web resources explaining this?