2014-09-09 21 views
13

Utilizzo il servizio di controllo di accesso per autorizzare l'accesso a specifiche sottoscrizioni di bus di servizio per specifiche identità di servizio.Operazioni del bus di servizio di Azure Sollevamento del timeoutException invece di UnauthorizedAccessException tramite ACS

Quando si ricevono sessioni o messaggi dall'abbonamento, l'identità del servizio è autorizzata e può ricevere, completare o abbandonare i messaggi secondo necessità.

Tuttavia, non vedo uno UnauthorizedAccessException quando si tenta di accedere a una sottoscrizione a cui l'identità del servizio non ha accesso, né vedo questa eccezione quando si tenta di eseguire un'operazione a cui il gruppo di regole non invia un reclamo per quella Service Identity and Relying Party (ad esempio Invia un messaggio o crea un argomento).

Invece, alla fine vedo uno TimeoutException - "The timeout elapsed upon attempting to obtain a token while accessing 'https://namespace-sb.accesscontrol.windows.net/WRAPv0.9/'". L'eccezione interna è SecurityTokenException - "The token provider was unable to provide a security token while accessing 'https://namespace-sb.accesscontrol.windows.net/WRAPv0.9/'. Token provider returned message: 'The operation has timed out'". Ciò causa un problema per RetryPolicy, poiché un'eccezione Timeout è considerata transitoria.

Stranamente, tuttavia, sto ricevendo un UnauthorizedAccessException quando si tenta di ricevere la Descrizione dell'abbonamento. Qualcosa che, secondo lo Rights Required for Service Bus Operations, dovrebbe essere disponibile per le identità di servizio con la richiesta di ascolto all'interno dell'ambito ... myTopic/Subscriptions/mySubscription.

Ho il seguente set up:

sto vedendo i seguenti problemi:

var manager = NamespaceManager.CreateFromConnectionString("Endpoint=sb://namespace.servicebus.windows.net/;SharedSecretIssuer=testidentity;SharedSecretValue=SSdtIE5vdCBUZWxsaW5n="); 
var description = manager.GetSubscription("myTopic","mySubscription"); 

Risultati in un UnauthoriszedAccessException - "The remote server returned an error: (401) Unauthorized." mi sarei aspettato di essere in grado di recuperare la descrizione, piuttosto che ricevere questa eccezione. Ciò che è interessante è che questo è l'unico regno a cui l'identità ha accesso ed è l'unica volta in cui vedo una eccezione non autorizzata.

var subscriptions = manager.GetSubscriptions("myTopic"); 

risultati in un TimeoutException, con un'eccezione interna di tipo SecurityTokenException. Mi aspetterei un UnauthorizedAccessException qui.

var client = SubscriptionClient.CreateFromConnectionString("Endpoint=sb://namespace.servicebus.windows.net/;SharedSecretIssuer=testidentity;SharedSecretValue=SSdtIE5vdCBUZWxsaW5n=", "myTopic", "otherSubscription"); 
var message = client.Receive() 

risultati in un messaggio di essere null, ma ancora una volta mi aspetterei un UnauthorizedAccessException. Esaminando l'uscita, vedo le eccezioni che si verificano nella finestra di output, ma essere inghiottito dal cliente:

A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.Net.WebException' occurred in System.dll 
A first chance exception of type 'Microsoft.ServiceBus.TokenProviderHelper.InternalSecurityTokenException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll 
A first chance exception of type 'System.TimeoutException' occurred in Microsoft.ServiceBus.dll 

Allo stesso modo, il tentativo di creare temi, inviare messaggi, ecc anche tradursi in un TimeoutException.

È questo il comportamento corretto quando si tenta di accedere a regni a cui l'identità del servizio non ha accesso, piuttosto che la mia aspettativa di ricevere uno UnauthorizedAccessException?

Immagino che l'impostazione abbia il risultato desiderato: le identità non possono ascoltare sottoscrizioni diverse da quelle identificate dal dominio di sottoscrizione a fronte del quale l'identità ha una regola di ascolto associata, ma sono preoccupato che il feedback dell'errore non è chiaro e risulterà in tentativi continui.

Qualsiasi consiglio sarebbe più apprezzato.

risposta

1

I nuovi spazi dei nomi SB creati dopo l'8/22 tramite il portale di Azure NON generano più gli spazi dei nomi ACS associati. Quindi è del tutto possibile che il timeout che stai ricevendo sia il comportamento corretto.

Per generare lo spazio dei nomi ACS, provare a creare lo spazio dei nomi SB utilizzando il cmdlet PowerShell new-azuresbnamespace.

+1

Sebbene si tratti di informazioni utili, i domini ACS complementari esistono. Altrimenti non sarei stato in grado di impostare le identità di servizio, affidandomi a partiti o gruppi di regole. Ho confermato l'utilizzo dell'interfaccia utente Web e ho configurato l'accesso utilizzando l'API a livello di codice. Se non fossero esistiti, non sarei stato in grado di farlo. Grazie lo stesso, però. – GaryJL

0

Alcuni di questi token hanno una durata/scadenza limitata. Quindi, se stai utilizzando un token che ha superato la sua scadenza, ciò potrebbe causare un errore di autorizzazione come quello che stai riscontrando.

Problemi correlati