示例#1
0
        public void AuthorizeEvent(ref WMS_EVENT pEvent, IWMSContext pUserCtx, IWMSContext pPresentationCtx, IWMSCommandContext pCommandCtx,
                                   IWMSEventAuthorizationCallback pCallback,
                                   object Context)
        {
            int       hr            = 0; // By deafault access is granted to user
            const int ACCESS_DENIED = unchecked ((int)0x80070005);

            string initial_request = null;
            string user_ip_address = null;
            string user_agent      = null;

            pPresentationCtx.GetStringValue(WMSDefines.WMS_PRESENT_REQUEST_NAME,
                                            WMSDefines.WMS_PRESENT_REQUEST_NAME_ID,
                                            out initial_request,
                                            0);
            pUserCtx.GetStringValue(WMSDefines.WMS_USER_IP_ADDRESS_STRING,
                                    WMSDefines.WMS_USER_IP_ADDRESS_STRING_ID,
                                    out user_ip_address,
                                    0);
            if (log.IsInfoEnabled)
            {
                pUserCtx.GetStringValue(WMSDefines.WMS_USER_AGENT,
                                        WMSDefines.WMS_USER_AGENT_ID,
                                        out user_agent,
                                        0);
            }

            URLValidationExceptionTyte errortype = url_procesor.CheckURLValidity(initial_request,
                                                                                 user_ip_address);

            if (URLValidationExceptionTyte.SUCCESS != errortype)
            {
                hr = ACCESS_DENIED;
            }

            if (log.IsInfoEnabled)
            {
                StringBuilder msg = new StringBuilder();
                if (user_agent != null)
                {
                    msg.Append("User-Agent=" + user_agent);
                }
                msg.Append(" User-Ip-Address=" + user_ip_address);
                msg.Append(" Request=" + initial_request);
                msg.Append(" Autorization-Result=" + errortype.ToString());
                log.Info(msg.ToString());
            }

            pCallback.OnAuthorizeEvent(hr, Context);
        }
示例#2
0
 public URLValidationException(URLValidationExceptionTyte ex_type)
 {
     my_type = ex_type;
 }
 public URLValidationException(URLValidationExceptionTyte ex_type)
 {
     my_type = ex_type;
 }