Ejemplo n.º 1
0
        /*
        private void checkForErrorInDispositionReport(dispositionReport report, String Error, String entityKey)
        {

            if (entityKey != null && report != null && report.countainsErrorCode(DispositionReport.E_INVALID_KEY_PASSED))
            {
                log.info("entityKey " + entityKey + " was not found in the registry");
            }
            else
            {
                if (report == null)
                {
                    log.info("Missing DispositionReport");
                }
                else
                {
                    foreach (result result in report.result)
                    {
                  //      log.error(result.getErrInfo().getErrCode() + " " + result.getErrInfo().getValue());
                    }
                }
            }
        }
        */
        /**
         * Gets an auth token from the uddi server using the uddi auth token
         * <br>
         * Notice: never log auth tokens! Treat it like a password
         *
         * notes: changed to public to have access from the subscription
         * callback API 8/20/2013 AO
         *
         * @param endpointURL
         * @return
         * @throws TransportException
         * @throws DispositionReportFaultMessage
         * @throws RemoteException
         */
        public String getAuthToken(String endpointURL)
        {
            //if the token is older then 10 minutes discard it, and create a new one.
            if ((authToken != null && !"".Equals(authToken)) && (tokenBirthDate != null && DateTime.Now > tokenBirthDate.AddMilliseconds(600000)))
            {
                discard_authToken discardAuthToken = new discard_authToken();
                discardAuthToken.authInfo = (authToken);
                using (UDDI_Security_SoapBinding sec = getUDDINode().getTransport().getUDDISecurityService(endpointURL))
                {
                    getUDDINode().getTransport().getUDDISecurityService(endpointURL).discard_authToken(discardAuthToken);
                    authToken = null;
                }
            }
            if (authToken == null || "".Equals(authToken))
            {
                tokenBirthDate = new DateTime();
                get_authToken getAuthToken = new get_authToken();
                getAuthToken.userID = (getPublisher());
                if (isEncrypted)
                {
                    if (String.IsNullOrEmpty(cryptoProvider))
                    {
                        log.error("Credentials are encrypted but no cryptoProvider was defined in the config file!");
                    }
                    else
                        try
                        {
                            getAuthToken.cred = (CryptorFactory.getCryptor(this.cryptoProvider).decrypt(getPassword()));
                        }
                        catch (Exception ex)
                        {
                            log.error("Unable to decrypt credentials! sending it as is", ex);
                            getAuthToken.cred = (getPassword());
                        }
                }
                else
                {
                    getAuthToken.cred = (getPassword());
                }
                using (UDDI_Security_SoapBinding sec = getUDDINode().getTransport().getUDDISecurityService(endpointURL))
                {
                    authToken = getUDDINode().getTransport().getUDDISecurityService(endpointURL).get_authToken(getAuthToken).authInfo;
                }

            }
            return authToken;
        }
Ejemplo n.º 2
0
 /**
 * kills the provided auth token, aka Logout
 */
 public void discardAuthToken(String token)
 {
     if (token != null)
     {
         try
         {
             discard_authToken discardAuthToken = new discard_authToken();
             discardAuthToken.authInfo=(token);
             getUDDINode().getTransport().getUDDISecurityService().discard_authToken(discardAuthToken);
             token = null;
         }
         catch (Exception ex)
         {
             log.warn("Error discarding auth token: " + ex.Message);
             log.debug("Error discarding auth token: " + ex.Message, ex);
         }
     }
 }
Ejemplo n.º 3
0
 /// <remarks/>
 public void discard_authTokenAsync(discard_authToken discard_authToken1)
 {
     this.discard_authTokenAsync(discard_authToken1, null);
 }
Ejemplo n.º 4
0
 /// <remarks/>
 public void discard_authTokenAsync(discard_authToken discard_authToken1, object userState)
 {
     if ((this.discard_authTokenOperationCompleted == null))
     {
         this.discard_authTokenOperationCompleted = new System.Threading.SendOrPostCallback(this.Ondiscard_authTokenOperationCompleted);
     }
     this.InvokeAsync("discard_authToken", new object[] {
             discard_authToken1}, this.discard_authTokenOperationCompleted, userState);
 }
Ejemplo n.º 5
0
 /// <remarks/>
 public System.IAsyncResult Begindiscard_authToken(discard_authToken discard_authToken1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("discard_authToken", new object[] {
             discard_authToken1}, callback, asyncState);
 }