 | Security Implementation with Webservice 2 |
|
| | 1: download web service 2 from net .
| | 2:
| | 3: namespace to be used : Microsoft.Web.Services2
| | 4:
| | 5: using Microsoft.Web.Services2.Security;<BR>
| | 6: using Microsoft.Web.Services2.Security.Tokens;<BR>
| | 7:
| | 8: Implementation of UsernameToken objects</u><BR>
| | 9:
| | 10: ///
| | 11: <summary>
| | 12: /// This class will be invoked in the Policy file during a SOAP request.
| | 13: /// </summary>
| | 14:
| | 15: public class AuthenticationManager : UsernameTokenManager
| | 16:
| | 17: {
| | 18:
| | 19: ///
| | 20: <summary>
| | 21: /// This method returns the password for the provided username.
| | 22: /// WSE will make the determination if they match.
| | 23: /// ///
| | 24: <PARAM name="token">
| | 25: </PARAM>
| | 26: /// <returns>
| | 27: </returns>
| | 28:
| | 29:
| | 30: protected override string AuthenticateToken( UsernameToken token )
| | 31: {
| | 32:
| | 33: string username = token.Username;
| | 34:
| | 35: // The following may be substituted with a more complex lookup routine...
| | 36: if (String.Compare("dnnuser", username, true) == 0)
| | 37: return ConfigurationSettings.AppSettings["SecurityTokenPassword"].ToString();
| | 38: else
| | 39: return String.Empty; }
| | 40:
| | 41: }
| | 42:
| | 43:
| | 44: |
|