These are some more or less useful code snippets that may or may not be useful. Feel free to add your own snippets or to use the posted ones.
http://codex.galleryproject.org/index.php/Gallery2:Embedding:Code_Snippets:Something whereas you should replace 'Something' with sth more meaningful and then add a link here on this page to your code snippet page.
Also see: Gallery Embedding Overview
A small code snippet to examplify the basics of GalleryEmbed is attached to this post (sample_embedding_wrapper.zip).
How a LDAP authentication could be done, take a look at http://galleryproject.org/node/27280#comment-96078