Skip to content

Commit 6da9e89

Browse files
committed
Unauthorized callback
1 parent 427a45c commit 6da9e89

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

Saleslogix.SData.Client/Framework/IAuthenticator.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ namespace Saleslogix.SData.Client.Framework
77
public interface IAuthenticator
88
{
99
void Authenticate(WebRequest request);
10+
UnauthorizedAction Unauthorized(WebResponse response);
11+
}
12+
13+
public enum UnauthorizedAction
14+
{
15+
Throw,
16+
Retry
1017
}
1118
}

Saleslogix.SData.Client/Framework/SDataRequest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ public virtual SDataResponse GetResponse()
215215
attempts--;
216216
continue;
217217
}
218+
if (ex.Status == WebExceptionStatus.ProtocolError &&
219+
((HttpWebResponse) ex.Response).StatusCode == HttpStatusCode.Unauthorized &&
220+
Authenticator != null && Authenticator.Unauthorized(ex.Response) == UnauthorizedAction.Retry)
221+
{
222+
continue;
223+
}
218224
throw new SDataException(ex);
219225
}
220226

Saleslogix.SData.Client/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// by using the '*' as shown below:
2727

2828
[assembly: AssemblyVersion("2.0")]
29-
[assembly: AssemblyFileVersion("2.0.1.1562")]
29+
[assembly: AssemblyFileVersion("2.0.2.1563")]
3030
[assembly: NeutralResourcesLanguage("en-US")]
3131
[assembly: AssemblyInformationalVersion("2.0")]
3232
[assembly: InternalsVisibleTo("Saleslogix.SData.Client.Test, PublicKey=" +

0 commit comments

Comments
 (0)