示例#1
0
        public ServiceList FindService(FindService fs)
        {
            Debug.Enter();
            ServiceList sl = null;

            try
            {
                sl = fs.Find();

                //
                // Maybe we could filter service projections out earlier, but this seems to be the
                // most readable place to do it.
                //
                if (1 == Context.ApiVersionMajor)
                {
                    sl.ServiceInfos = FilterServiceProjections(sl.ServiceInfos, fs.BusinessKey);
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(sl);
        }
示例#2
0
        //public BusinessList FindBusiness( FindBusiness fbus, [XmlAnyElement] XmlElement[] trash )
        public BusinessList FindBusiness(FindBusiness fbus)
        {
            Debug.Enter();
            BusinessList bl = null;

            try
            {
                bl = fbus.Find();

                //
                // If this request came from a v1 message, filter out any service projections in our list of
                // businesses
                //
                if (1 == Context.ApiVersionMajor)
                {
                    foreach (BusinessInfo businessInfo in bl.BusinessInfos)
                    {
                        businessInfo.ServiceInfos = FilterServiceProjections(businessInfo.ServiceInfos, businessInfo.BusinessKey);
                    }
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bl);
        }
示例#3
0
        public DispositionReport DiscardAuthToken(DiscardAuthToken dat)
        {
            Debug.Enter();
            DispositionReport dr = new DispositionReport();

            try
            {
                if ((Config.GetInt("Security.AuthenticationMode") == (int)AuthenticationMode.Passport))
                {
                    PassportAuthenticator authenticator = new PassportAuthenticator();
                    authenticator.Authenticate(dat.AuthInfo, Config.GetInt("Security.TimeOut"));

                    //
                    // Call to the database to update the user status to logged off.
                    //
                    SqlCommand cmd = new SqlCommand("ADM_setPublisherStatus", ConnectionManager.GetConnection());

                    cmd.Transaction = ConnectionManager.GetTransaction();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID)).Direction = ParameterDirection.Input;
                    cmd.Parameters.Add(new SqlParameter("@publisherStatus", SqlDbType.NVarChar, UDDI.Constants.Lengths.PublisherStatus)).Direction = ParameterDirection.Input;

                    SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters);
                    paramacc.SetString("@PUID", Context.User.ID);
                    paramacc.SetString("@publisherStatus", "loggedOut");
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(dr);
        }
示例#4
0
        public DispositionReport AddPublisherAssertions(AddPublisherAssertions message)
        {
            Debug.Enter();

            //
            // Create a disposition report indicating success
            //
            DispositionReport report = new DispositionReport();

            try
            {
                //
                // Add the publisher assertions.
                //
                message.Save();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();

            return(report);
        }
示例#5
0
        private void CheckSOAPHeaders(SoapMessage message)
        {
            // We want to check the following:
            //
            // - no SOAP Actor attribute exists
            // - no SOAP headers can have a must_understand attribute set to true
            //
            // Go through each header in our message
            //
            foreach (SoapHeader header in message.Headers)
            {
                if (header.MustUnderstand)
                {
                    //
                    // No headers can have this attribute set.
                    //
                    DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_SOAP_MUSTUNDERSTANDATT"));

                    return;
                }

                if (header.Actor.Length > 0)
                {
                    //
                    // Can't have a SOAP Actor attribute set, generate a SOAP fault with
                    // no detail element and a 'Client' fault code
                    //
                    DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_SOAP_ACTORATT"));

                    return;
                }
            }
        }
示例#6
0
        public DispositionReport ValidateCategorization(ValidateCategorization vc)
        {
            Debug.Enter();

            try
            {
                vc.Validate();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(new DispositionReport());
        }
示例#7
0
        public BindingDetail FindBinding(FindBinding fbind)
        {
            Debug.Enter();
            BindingDetail bd = null;

            try
            {
                bd = fbind.Find();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bd);
        }
示例#8
0
        public TModelDetail GetTModelDetail(GetTModelDetail gtmd)
        {
            Debug.Enter();
            TModelDetail tmd = new TModelDetail();

            try
            {
                tmd.Get(gtmd.TModelKeys);
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(tmd);
        }
示例#9
0
        public ServiceDetail GetServiceDetail(GetServiceDetail gsd)
        {
            Debug.Enter();
            ServiceDetail sd = new ServiceDetail();

            try
            {
                sd.Get(gsd.ServiceKeys);
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(sd);
        }
示例#10
0
        public BusinessDetailExt GetBusinessDetailExt(GetBusinessDetailExt gbde)
        {
            Debug.Enter();
            BusinessDetailExt bde = new BusinessDetailExt();

            try
            {
                bde.Get(gbde.BusinessKeys);
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bde);
        }
示例#11
0
        public BindingDetail GetBindingDetail(GetBindingDetail gbd)
        {
            Debug.Enter();
            BindingDetail bd = new BindingDetail();

            try
            {
                bd.Get(gbd.BindingKeys);
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bd);
        }
示例#12
0
        public RelatedBusinessList FindRelatedBusinesses(FindRelatedBusinesses frelbus)
        {
            Debug.Enter();
            RelatedBusinessList rbl = null;

            try
            {
                rbl = frelbus.Find();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(rbl);
        }
示例#13
0
        public RegisteredInfo GetRegisteredInfo(GetRegisteredInfo gri)
        {
            Debug.Enter();
            RegisteredInfo ri = new RegisteredInfo();

            try
            {
                ri.Get();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(ri);
        }
示例#14
0
        public BusinessDetail SaveBusiness(SaveBusiness sb)
        {
            Debug.Enter();
            BusinessDetail bd = new BusinessDetail();

            try
            {
                sb.Save();
                bd.BusinessEntities = sb.BusinessEntities;
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bd);
        }
示例#15
0
        public BindingDetail SaveBinding(SaveBinding sb)
        {
            Debug.Enter();
            BindingDetail bd = new BindingDetail();

            try
            {
                sb.Save();
                bd.BindingTemplates = sb.BindingTemplates;
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bd);
        }
示例#16
0
        public TModelList FindTModel(UDDI.API.ServiceType.FindTModel ftm)
        {
            Debug.Enter();
            TModelList tml = null;

            try
            {
                tml = ftm.Find();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();
            return(tml);
        }
示例#17
0
        public ServiceDetail SaveService(SaveService ss)
        {
            Debug.Enter();
            ServiceDetail sd = new ServiceDetail();

            try
            {
                ss.Save();
                sd.BusinessServices = ss.BusinessServices;
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(sd);
        }
示例#18
0
        public BusinessDetail GetBusinessDetail(GetBusinessDetail gbd)
        {
            Debug.Enter();

            BusinessDetail bd = new BusinessDetail();

            try
            {
                bd.Get(gbd.BusinessKeys);
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bd);
        }
示例#19
0
        public TModelDetail SaveTModel(UDDI.API.ServiceType.SaveTModel stm)
        {
            Debug.Enter();
            TModelDetail tmd = new TModelDetail();

            try
            {
                stm.Save();
                tmd.TModels = stm.TModels;
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(tmd);
        }
示例#20
0
        public AssertionStatusReport GetAssertionStatusReport(GetAssertionStatusReport message)
        {
            Debug.Enter();

            AssertionStatusReport statusReport = new AssertionStatusReport();

            try
            {
                statusReport.Get(message.CompletionStatus);
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();

            return(statusReport);
        }
示例#21
0
        public DispositionReport DeleteService(DeleteService ds)
        {
            Debug.Enter();
            DispositionReport dr = new DispositionReport();

            try
            {
                //
                // Delete the service
                //
                ds.Delete();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(dr);
        }
示例#22
0
        public DispositionReport DeletePublisherAssertions(DeletePublisherAssertions message)
        {
            Debug.Enter();

            DispositionReport report = new DispositionReport();

            try
            {
                message.Delete();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();

            return(report);
        }
示例#23
0
        public DispositionReport DeleteTModel(DeleteTModel dtm)
        {
            Debug.Enter();
            DispositionReport dr = new DispositionReport();

            try
            {
                //
                // Delete the tModel
                //
                dtm.Delete();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(dr);
        }
示例#24
0
        public PublisherAssertionDetail SetPublisherAssertions(SetPublisherAssertions message)
        {
            Debug.Enter();

            PublisherAssertionDetail detail = new PublisherAssertionDetail();

            try
            {
                detail = message.Set();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();

            return(detail);
        }
示例#25
0
        public DispositionReport DeleteBusiness(DeleteBusiness dbus)
        {
            Debug.Enter();

            DispositionReport dr = new DispositionReport();

            try
            {
                //
                // Delete the business
                //
                dbus.Delete();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(dr);
        }
示例#26
0
        public DispositionReport DeleteBinding(DeleteBinding dbind)
        {
            Debug.Enter();

            //
            // Create dispositionReport indicating success
            //
            DispositionReport dr = new DispositionReport();

            try
            {
                //
                // Delete the binding
                //
                dbind.Delete();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(dr);
        }
示例#27
0
        //
        // TODO: see if there is a way to better modularize this method and rename it.
        //
        private void CheckForSingleRequest(Stream stream)
        {
            try
            {
                //
                // Move to the start of our stream
                //
                stream.Position = 0;
                XmlTextReader requestReader = new XmlTextReader(oldStream);
                requestReader.MoveToContent();

                //
                // TODO: should not hard-code SOAP names and namespaces
                //

                //
                // Move to the beginning of the SOAP envelope
                //
                requestReader.ReadStartElement("Envelope", "http://schemas.xmlsoap.org/soap/envelope/");

                //
                // Move to the SOAP body
                //
                while (!requestReader.IsStartElement("Body", "http://schemas.xmlsoap.org/soap/envelope/") && !requestReader.EOF)
                {
                    requestReader.Skip();
                }

                //
                // Advance the current node to the first child of Body.  This is presumably the UDDI message
                //
                requestReader.ReadStartElement("Body", "http://schemas.xmlsoap.org/soap/envelope/");
                requestReader.MoveToContent();

                //
                // This element MUST have a UDDI namespace
                //
                string uddiNamespace = requestReader.LookupNamespace(requestReader.Prefix);

                switch (uddiNamespace)
                {
                case "urn:uddi-org:api":
                {
                    Context.ApiVersionMajor = 1;
                    break;
                }

                case "urn:uddi-org:api_v2":
                {
                    Context.ApiVersionMajor = 2;
                    break;
                }

                case "urn:uddi-microsoft-com:api_v2_extensions":
                {
                    Context.ApiVersionMajor = 2;
                    break;
                }

                case "urn:uddi-org:repl":
                {
                    Context.ApiVersionMajor = 2;
                    break;
                }

                default:
                {
                    //
                    // This is a problem, we don't have a UDDI namespace.  Throw an exception and get out of here.  The
                    // exception will be caught in our outer catch and sent to our client using DispositionReport.ThrowFinal.
                    //

                    throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_MISSINGUDDINS");
                }
                }

                //
                // Skip the children of this node
                //
                requestReader.Skip();
                requestReader.MoveToContent();

                //
                // Reset our stream so someone else can use it.
                //
                stream.Position = 0;

                //
                // If we are not at the end of the Body tag, then we have multiple requests, we should reject the message.
                //
                if (false == requestReader.LocalName.Equals("Body"))
                {
                    DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_SOAP_MULTIPLEREQUEST"));
                }
            }
            catch (UDDIException uddiException)
            {
                DispositionReport.ThrowFinal(uddiException);
            }
            catch
            {
                //
                // We'll get this exception if the message contains any invalid elements
                //
                DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_SOAP_INVALIDELEMENT"));
            }
        }
示例#28
0
        public override void ProcessMessage(SoapMessage message)
        {
            try
            {
                switch (message.Stage)
                {
                case SoapMessageStage.BeforeDeserialize:
                    //
                    // Check to see if the server has been manually stopped.
                    //
                    if (0 == Config.GetInt("Run", 1))
                    {
                        DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_busy, "UDDI_ERROR_BUSY_SERVICENOTAVAILABLE"));

                        //
                        // DispositionReport.ThrowFinal will close the HTTP stream so there is no point going on in this method
                        //
                        return;
                    }

                    try
                    {
                        //
                        // Validate against the UDDI schemas
                        //
                        SchemaCollection.Validate(oldStream);
                    }
                    catch (Exception e)
                    {
                        DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_SCHEMAVALIDATIONFAILED", e.Message));

                        //
                        // DispositionReport.ThrowFinal will close the HTTP stream so there is no point going on in this method
                        //
                        return;
                    }

                    //
                    // Make sure we only have 1 UDDI request in the SOAP body.  This method will also set the versionMajor
                    // member.
                    //
                    CheckForSingleRequest(oldStream);

                    //
                    // If this is a v1 message, we'll first map it to the v2
                    // namespace so that it can be processed by the new
                    // library.
                    //
                    if (1 == Context.ApiVersionMajor || 2 == Context.ApiVersionMajor)
                    {
                        TextReader reader = new StreamReader(oldStream);
                        TextWriter writer = new StreamWriter(newStream, new System.Text.UTF8Encoding(false));
                        string     xml    = reader.ReadToEnd();

                        if (1 == Context.ApiVersionMajor)
                        {
                            xml = xml.Replace("=\"urn:uddi-org:api\"", "=\"urn:uddi-org:api_v2\"");
                            xml = xml.Replace("='urn:uddi-org:api'", "=\"urn:uddi-org:api_v2\"");
                        }
                        writer.Write(xml);
                        writer.Flush();

                        newStream.Position = 0;
                    }

                    break;

                case SoapMessageStage.AfterDeserialize:
                    //
                    // After the message is deserialized is the earliest place where we
                    // have access to our SOAP headers.
                    //
                    CheckSOAPHeaders(message);

                    //
                    // Now that the message has been deserialized, make
                    // sure that the generic and xmlns attributes agree.
                    //
                    IMessage obj = message.GetInParameterValue(0) as IMessage;
                    if (null != obj)
                    {
                        //
                        // We only need to do this if the deserialized object supports IMessage
                        //
                        string expected = Context.ApiVersionMajor + ".0";
                        string actual   = obj.Generic.Trim();

                        if (expected != actual)
                        {
                            throw new UDDIException(ErrorType.E_unrecognizedVersion, "UDDI_ERROR_UNKNOWNVERSION_GENERICNAMESPACEMISMATCH");
                        }
                    }

                    break;

                case SoapMessageStage.BeforeSerialize:
                    break;

                case SoapMessageStage.AfterSerialize:

                    //
                    // There may have been exceptions thrown during serialization.
                    //
                    if (null != message.Exception &&
                        (null == message.Exception.Detail ||
                         0 == message.Exception.Detail.ChildNodes.Count))
                    {
                        DispositionReport.ThrowFinal(new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_FAILEDDESERIALIZATION"));

                        //
                        // DispositionReport.ThrowFinal will close the HTTP stream so there is no point going on in this method
                        //
                        return;
                    }

                    //
                    // If the original request was v1, then we'll need to
                    // remap the output to use the v1 namespace.
                    //
                    if (1 == Context.ApiVersionMajor || 2 == Context.ApiVersionMajor)
                    {
                        newStream.Position = 0;

                        TextReader reader = new StreamReader(newStream);
                        TextWriter writer = new StreamWriter(oldStream, new System.Text.UTF8Encoding(false));

                        string xml = reader.ReadToEnd();

                        //
                        // We don't have to use the same 'loose' replacement as we did on the incoming request
                        // because our response will be serialized such that the default namespace is our UDDI
                        // namespace.
                        //

                        if (1 == Context.ApiVersionMajor)
                        {
                            xml = xml.Replace("xmlns=\"urn:uddi-org:api_v2\"", "xmlns=\"urn:uddi-org:api\"");
                            xml = xml.Replace("generic=\"2.0\"", "generic=\"1.0\"");
                        }
                        writer.Write(xml);
                        writer.Flush();
                    }

                    break;

                default:
                    throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_UNKNOWNEXTSTAGE");
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }
        }
示例#29
0
        public override void ProcessMessage(SoapMessage message)
        {
            Debug.Enter();

#if DEBUG
            string info = "log: " + data.log.ToString() +
                          "; https: " + data.https.ToString() +
                          "; validate: " + data.validate.ToString() +
                          "; performance: " + data.performance.ToString() +
                          "; authenticate: " + data.authenticate.ToString() +
                          "; transaction: " + data.transaction.ToString() +
                          "; messageType: " + data.messageType;

            Debug.Write(SeverityType.Info, CategoryType.Soap, info);
#endif
            try
            {
                switch (message.Stage)
                {
                //
                // First Event
                //
                case SoapMessageStage.BeforeDeserialize:
                    //
                    // Initialize our context.
                    //
                    Context.Current.Initialize();

                    Config.CheckForUpdate();

                    //
                    // TODO: Since we are using DispositionReport.ThrowFinal() I don't think this is
                    // needed anymore.
                    //

                    //
                    // Check to make sure the authenticated user has user credentials
                    //
                    Debug.Verify("1" != HttpContext.Current.Request.ServerVariables["Exception"],
                                 "UDDI_ERROR_FATALERROR_VERSIONCHECKERROR",
                                 UDDI.ErrorType.E_fatalError);

                    Debug.Write(SeverityType.Info, CategoryType.Soap, "URL: " + message.Url);
                    Debug.Write(SeverityType.Info, CategoryType.Soap, "SOAPAction: " + HttpContext.Current.Request.Headers["SOAPAction"]);

                    string contentType = HttpContext.Current.Request.ContentType.ToLower();

                    bool validEncoding = (contentType.IndexOf("charset=\"utf-8\"") >= 0) ||
                                         (contentType.IndexOf("charset=utf-8") >= 0);

                    Debug.Verify(validEncoding, "UDDI_ERROR_UNSUPPORTED_CONTENTTYPEHEADERMISSING", ErrorType.E_unsupported);

                    if (data.performance)
                    {
                        PublishMethodBegin(message);
                    }

                    if (data.https)
                    {
                        CheckForHttps(message);
                    }

                    //
                    // Validation has been moved into the other SOAP extension
                    //
//						if( data.validate )
//							Validate( message );

                    break;

                //
                // Second Event
                //
                case SoapMessageStage.AfterDeserialize:

                    ConnectionManager.Open(data.transaction, data.transaction);

                    if (data.certificate)
                    {
                        CheckCertificate(message);
                    }

                    if (data.authenticate)
                    {
                        Authenticate(message);
                    }
                    else if (0 != (Config.GetInt("Security.AuthenticationMode", (int)AuthenticationMode.Both)
                                   & (int)AuthenticationMode.AuthenticatedRead))
                    {
                        //
                        // Authenticated reads are turned on and this is a read request
                        // Make sure the caller is authenticated using Windows and is at least a user
                        //
                        WindowsIdentity      identity = (WindowsIdentity)HttpContext.Current.User.Identity;
                        WindowsAuthenticator wa       = new WindowsAuthenticator();
                        wa.Authenticate("", 0 /* not used */);

                        Debug.Write(SeverityType.Info, CategoryType.Soap, "Authenticated user: using Windows based authentication Identity is " + identity.Name);

                        //
                        // Check to make sure the authenticated user has user credentials
                        //
                        Debug.Verify(Context.User.IsUser,
                                     "UDDI_ERROR_FATALERROR_NOUSERCREDS",
                                     UDDI.ErrorType.E_fatalError,
                                     Context.User.ID);
                    }

                    break;

                //
                // Third Event
                //
                case SoapMessageStage.BeforeSerialize:
                    break;

                //
                // Last Event
                //
                case SoapMessageStage.AfterSerialize:

                    //
                    // Cleanup the connection and commit the database activity
                    //
                    if (data.transaction &&
                        (null != (object)ConnectionManager.GetConnection()) &&
                        (null != (object)ConnectionManager.GetTransaction()))
                    {
                        if (null == (object)message.Exception)
                        {
                            ConnectionManager.Commit();
                        }
                        else
                        {
                            ConnectionManager.Abort();
                        }
                    }

                    ConnectionManager.Close();

                    try
                    {
                        if (data.performance)
                        {
                            PublishMethodEnd(message);
                        }
                    }
                    catch
                    {
                        Debug.OperatorMessage(
                            SeverityType.Warning,
                            CategoryType.None,
                            OperatorMessageType.UnableToPublishCounter,
                            "An error occurred while trying to publish a performance counter, the system will continue");
                    }

                    break;

                default:
                    throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_UNKNOWNEXTSTAGE");
                }
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();
        }
示例#30
0
        public AuthToken GetAuthToken(GetAuthToken gat)
        {
            Debug.Enter();
            AuthToken at = new AuthToken();

            try
            {
                //
                // XX-SECURITY: Review the value here in the case where we use
                // XX-this with a web.config with Authentication set to None or Passport
                //
                //
                // NOW:	We now Get a Generic Identity.  If the AuthenticationMode is AuthenticationMode.Passport (8),
                //		we make sure the Identity is a PassportIdentity, then we authenticate.  If AuthenticationMode
                //		is Not set to AuthenticationMode.Passport, then process it as a WindowsIdentity.
                //
                //

                IIdentity identity = HttpContext.Current.User.Identity;

                int mode = Config.GetInt("Security.AuthenticationMode", (int)AuthenticationMode.Both);
                if (((int)AuthenticationMode.Passport) == mode)
                {
                    if (identity is PassportIdentity)
                    {
                        Debug.Write(SeverityType.Info, CategoryType.Soap, "Generating credentials for Passport based authentication Identity is " + gat.UserID);

                        PassportAuthenticator pa = new PassportAuthenticator();

                        //
                        // Get a Passport ticket for this user.
                        //
                        if (!pa.GetAuthenticationInfo(gat.UserID, gat.Cred, out at.AuthInfo))
                        {
                            // throw new UDDIException( ErrorType.E_unknownUser, "User failed authentication." ) ;
                            throw new UDDIException(ErrorType.E_unknownUser, "USER_FAILED_AUTHENTICATION");
                        }

                        //
                        // We need to extract the PUID from the ticket and put it into our Context.UserInfo.ID; a
                        // successfull call to Authenticate will do all of this.
                        //
                        if (!pa.Authenticate(at.AuthInfo, UDDI.Constants.Passport.TimeWindow))
                        {
                            throw new UDDIException(ErrorType.E_unknownUser, "UDDI_ERROR_USER_FAILED_AUTHENTICATION");
                        }

                        //
                        // Make sure this Passport user has registered with our UDDI site as a publisher.
                        //
                        if (!Context.User.IsVerified)
                        {
                            // throw new UDDIException( ErrorType.E_unknownUser, "Not a valid publisher." ) ;
                            throw new UDDIException(ErrorType.E_unknownUser, "UDDI_ERROR_NOT_A_VALID_PUBLISHER");
                        }
                    }
                    else
                    {
#if never
                        throw new UDDIException(ErrorType.E_fatalError,
                                                "CONFIGURATION ERROR:  Passport Identity Expected.  \r\n" +
                                                "You are currently running in Passport Authentication Mode. \r\n" +
                                                "Check your web.config for the <authentication mode=\"Passport\" /> entry and try again.");
#endif

                        throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_PASSPORT_CONFIGURATION_ERROR");
                    }
                }

                //
                // SECURITY: Check to make sure the password is blank too
                //
                else if (!((WindowsIdentity)identity).IsAnonymous &&
                         ((mode & (int)AuthenticationMode.Windows) != 0) &&
                         Utility.StringEmpty(gat.UserID))
                {
                    Debug.Write(SeverityType.Info, CategoryType.Soap, "Generating credentials for Windows based authentication Identity is " + identity.Name);
                    WindowsAuthenticator wa = new WindowsAuthenticator();
                    wa.GetAuthenticationInfo(gat.UserID, gat.Cred, out at.AuthInfo);
                }
                else if ((mode & (int)AuthenticationMode.Uddi) != 0)
                {
                    Debug.Write(SeverityType.Info, CategoryType.Soap, "Generating credentials for UDDI based authentication");
                    UDDIAuthenticator ua = new UDDIAuthenticator();
                    ua.GetAuthenticationInfo(gat.UserID, gat.Cred, out at.AuthInfo);
                }
                else
                {
                    //	throw new UDDIException( UDDI.ErrorType.E_unsupported,
                    //"The UDDI server is not configured to support the requested form of authentication." );
                    throw new UDDIException(UDDI.ErrorType.E_unsupported, "UDDI_ERROR_AUTHENTICATION_CONFIGURATION_ERROR");
                }

                Debug.Write(SeverityType.Info, CategoryType.Soap, "Windows Identity is " + WindowsIdentity.GetCurrent().Name);
                Debug.Write(SeverityType.Info, CategoryType.Soap, "Thread Identity is " + System.Threading.Thread.CurrentPrincipal.Identity.Name);
                Debug.Write(SeverityType.Info, CategoryType.Soap, "HttpContext Identity is " + identity.Name);

                //
                // Check to make sure the authenticated user has publisher credentials
                //
#if never
                Debug.Verify(Context.User.IsPublisher,
                             "The user account " + Context.User.ID + " does not have publisher credentials",
                             UDDI.ErrorType.E_fatalError);
#endif

                Debug.Verify(Context.User.IsPublisher,
                             "UDDI_ERROR_NO_PUBLISHER_CREDENTIALS",
                             UDDI.ErrorType.E_fatalError,
                             Context.User.ID);

                Debug.Write(
                    SeverityType.Info,
                    CategoryType.Authorization,
                    "Authenticated user (userid = " + gat.UserID + " )");
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(at);
        }