Thursday, March 22, 2012

Web Service security, need to be configurable

Here is my web service:

<WebMethod(), PrincipalPermissionAttribute(SecurityAction.Demand, Authenticated:=True, Role:="MyDomain\Domain Users")> _
Public Function GetData(ByVal strTableName As String, ByVal blnCustom As Boolean) As DataSet
'**********************************************************************************
'Gets the data for the given table name
'**********************************************************************************
GetData = DBGetData(strTableName, blnCustom)
End Function

The problem I am having is that I want to be able to make the Role attribute (Role:="MyDomain\Domain Users") changable when installed on the client machine. I wanted to do this with the web.config file if possible. Of course, it says it needs a constant in order to work. The problem with that is I want dynamic. We have been fighting back and forth, and the web service is winning.:( How do I change this instead of having to recompile?Well, for a work around, I am checking the HTTPContext to see if the user is in the role.

0 comments:

Post a Comment