|
1 |
| -using System; |
2 |
| -using System.Collections.Generic; |
3 |
| -using System.Data.SqlClient; |
4 |
| -using System.Linq; |
5 |
| -using DotNetOpenAuth.Messaging.Bindings; |
6 |
| - |
7 |
| -namespace DotNetOpenAuth.WebAPI.HostSample.Infrastructure.OAuth { |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Data.SqlClient; |
| 4 | +using System.Linq; |
| 5 | +using DotNetOpenAuth.Messaging.Bindings; |
| 6 | + |
| 7 | +namespace DotNetOpenAuth.WebAPI.HostSample.Infrastructure.OAuth { |
8 | 8 | /// <summary>
|
9 | 9 | /// A database-persisted nonce store.
|
10 | 10 | /// </summary>
|
@@ -57,11 +57,12 @@ public bool StoreNonce(string context, string nonce, DateTime timestampUtc) {
|
57 | 57 | #region ICryptoKeyStore Members
|
58 | 58 |
|
59 | 59 | public CryptoKey GetKey(string bucket, string handle) {
|
60 |
| - // It is critical that this lookup be case-sensitive, which can only be configured at the database. |
61 |
| - var matches = from key in MvcApplication.DataContext.SymmetricCryptoKeys |
62 |
| - where key.Bucket == bucket && key.Handle == handle |
63 |
| - select new CryptoKey(key.Secret, key.ExpiresUtc.AsUtc()); |
64 |
| - |
| 60 | + var _db = MvcApplication.DataContext.SymmetricCryptoKeys.Where(k => k.Bucket == bucket && k.Handle == handle).ToList(); |
| 61 | + // Perform a case senstive match |
| 62 | + var matches = from key in _db |
| 63 | + where string.Equals(key.Bucket, bucket, StringComparison.Ordinal) && |
| 64 | + string.Equals(key.Handle, handle, StringComparison.Ordinal) |
| 65 | + select new CryptoKey(key.Secret, key.ExpiresUtc.AsUtc()); |
65 | 66 | return matches.FirstOrDefault();
|
66 | 67 | }
|
67 | 68 |
|
|
0 commit comments