In SharePoint Server 2010 we have a service to save type of authentication safe and we can to use it in other application. In this example we are going to connect to a data base in SQL Server to create external content type using this way to pass the credential to the data base. We are use a SQL Server authentication and the user and the password will be saving in the “Secure Store Service”.
In the image 1 we can see the home page of central administration of SharePoint 2010 and we are going to select the link “Manage Service Application”
Once the page of services was loaded, we have all service of SharePoint 2010 as we can see in image 2.
In the list of the services we can have the default service “Secure Store Service”, but for this example I have other named “Blog Secure Store” as we can see in the image 2. We are going to select our service to go the home page of it, as we can see in the image 3.
If you first time in the service, then you can see a message saying that we must configure it. We are going to select the button “Generate New Key” in the toolbar as we can see in image 3, to go to the new popup as we can see in image 4.
In this popup we must load the Phrase Pass, a text that will be used to encrypt the data in the data base. This Phrase not save in the data base, for that, you need remember it or save a in safe place to have access it when you need. When we are ready, we are going to select the button “Ok” to return the home page of the service, as we can see in the image 5.
In this time, the home page not has the message saying that the service is not configured; now we are ready to create the first configuration to an application. We are going to select the button “New” in the toolbar to open a creation wizard as we can see in image 6.
The first step is crate an ID for our application, this ID must be unique and we don’t change in the future, after that, we must set a name, the type of authentication (we have several types to use, in this example we are going to use an individual type), we must select “Individual” and the last configuration is the target application page, for this example we are going to use the default value. Once all value was loaded we are going to select the button “Next” to go to the second step as we can see in image 7.
In this step we must create or configure our credentials. How we are creating credentials to connect to the data base, in the textbox we would be set a relevant name for our credentials, for this example used “SQL User” to save the user name and “SQL Password” to save the password of the user. In the type of field we can select the types of authentication that we must use. In my case, I will use “User Name” for the name of the user and “Password” for the password of the user. Also we can select if one of our field must have a “Mask” to show a special characters when the user is loading the credentials. When we are ready with the configuration, we must select the button “Next” to go to the final step of the Wizard as we can see in the image 8.
In the last step we are going to set the owner of the application and we are going to select “Ok” to go the home page of the service as we can see in the image 9.
Well, once the application configuration was crated, the next step is to set the credentials (user and password) that we want to save in the secure store. For that, in the contextual menu we could select the option “Set Credential” or in the toolbar we could select “Set” if our configuration is marked. When we select one of the options a new popup will be opened as we can see in image 10.
In this new window we must load the credentials of the user of SQL Server that we are going to use to connect to the data base; in my case I’m configuring the credential to the user “sa” of my SQL Server. Once the information of credential and the owner are ready, we are going to select the button “Ok” to save it in the secure store service.
Ok, we are ready to use this new configuration in an application. As I commented before, we are using the new configuration to connect a data base to create external content type. In the SharePoint Designer 2010 (How work or How to do an external content type will be see in other post) when we need to connect to a data base, we are going to set our configuration. In image 11 we can see the windows to create a connection to the server; one of the value that we can set is the name of a “Connect with Impersonated Custom Identity” where we are going to load the id of our configuration.
In the image 12 we can see the connection working with our application credential in the secure store of SharePoint server 2010.