public override void ProcessMessage(SoapMessage message) { if (message.Stage == SoapMessageStage.AfterDeserialize) { foreach (SoapHeader header in message.Headers) { if (header is SecuredToken) { authHeader = (SecuredToken)header; // if (authHeader.Password.Equals("pwd")) if (!string.IsNullOrEmpty(authHeader.AuthenticationToken)) { if (!string.IsNullOrEmpty(authHeader.AuthenticationToken)) { if (authHeader.IfUserCredentialIsValid(authHeader)) { return; } } } } } throw new SoapException("Unauthorized", SoapException.ClientFaultCode); } }
public bool IfUserCredentialIsValid(SecuredToken soapHeader) { if (soapHeader == null) { return(false); } if (!string.IsNullOrEmpty(soapHeader.AuthenticationToken)) { //return (HttpRuntime.Cache[soapHeader.AuthenticationToken] != null); // return (!string.IsNullOrEmpty(soapHeader.AuthenticationToken)); return(IsValid(soapHeader.AuthenticationToken)); } return(false); }