Writing secure code these days is a must; however the pain in deploying a secure application into a SharePoint environment has been too hard. Microsoft has come to the party with a new feature called “Solution Deployment” which not only helps with deployment of solutions (Web Parts, features, etc) to your SharePoint infrastructure but will also deploy CAS polices.
Maurice Prather has written an excellent post on the subject, to read his post please go to http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=249.