1) When you add a reference to a secured service to ArcGIS Online, you have the option to embed the credentials. See attached image.
2) Yes, currently we don't support uploading your own custom templates and have them run on our servers. Perhaps in the future.
Thanks,
Mike