Skip to content

Commit

Permalink
refactor(auth): Switch from Bearer/AccessToken to Token/ClientSecret (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasper Hesthaven authored Mar 17, 2022
1 parent a80f5e5 commit e935e85
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 196 deletions.
222 changes: 30 additions & 192 deletions AccuRanker.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
".NETCoreApp,Version=v2.2": {
"Microsoft.NET.Test.Sdk": {
"type": "Direct",
"requested": "[16.9.1, )",
"resolved": "16.9.1",
"contentHash": "9acz3fExifstaoKTAvHVwRGMFrtb1QLlT6KfxOFTYM4dksuzwpkApjt0xP+yJcuRsPcf14F1b0Du3GgfKZWHJw==",
"requested": "[17.1.0, )",
"resolved": "17.1.0",
"contentHash": "MVKvOsHIfrZrvg+8aqOF5dknO/qWrR1sWZjMPQ1N42MKMlL/zQL30FQFZxPeWfmVKWUWAOmAHYsqB5OerTKziw==",
"dependencies": {
"Microsoft.CodeCoverage": "16.9.1",
"Microsoft.TestPlatform.TestHost": "16.9.1"
"Microsoft.CodeCoverage": "17.1.0",
"Microsoft.TestPlatform.TestHost": "17.1.0"
}
},
"Microsoft.NETCore.App": {
Expand All @@ -26,39 +26,28 @@
},
"Moq": {
"type": "Direct",
"requested": "[4.16.1, )",
"resolved": "4.16.1",
"contentHash": "bw3R9q8cVNhWXNpnvWb0OGP4HadS4zvClq+T1zf7AF+tLY1haZ2AvbHidQekf4PDv1T40c6brZeT/V0IBq7cEQ==",
"requested": "[4.17.2, )",
"resolved": "4.17.2",
"contentHash": "HytUPJ3/uks2UgJ9hIcyXm3YxpFAR4OJzbQwTHltbKGun3lFLhEHs97hiiPj1dY8jV/kasXeihTzDxct6Zf3iQ==",
"dependencies": {
"Castle.Core": "4.4.0",
"Castle.Core": "4.4.1",
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"NUnit": {
"type": "Direct",
"requested": "[3.13.1, )",
"resolved": "3.13.1",
"contentHash": "vWBvrSelmTYwqHWvO3dA63z7cOpaFR/3nJ9MMVLBkWeaWa7oiglPPm5g1h96B4i2XXqjFexxhR5MyMjmIJYPfg==",
"requested": "[3.13.2, )",
"resolved": "3.13.2",
"contentHash": "u+fz/lXyR4vlamySNAEMrXvh+GhAQiB6/aVZtU5WjivR5zF26Ui0tfteDtWqT90k9D8y6g8rFKYQC97Z7d195w==",
"dependencies": {
"NETStandard.Library": "2.0.0"
}
},
"NUnit3TestAdapter": {
"type": "Direct",
"requested": "[3.17.0, )",
"resolved": "3.17.0",
"contentHash": "I9MNvK+GM2yXrHPitwZkAZKU9sYI2OO/8wKC+VuBD7V3z+ySQ1pSopX/urr0ooedI8/TIcajYPRO4vGRr7AM8A==",
"dependencies": {
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"System.ComponentModel.EventBasedAsync": "4.3.0",
"System.ComponentModel.TypeConverter": "4.3.0",
"System.Diagnostics.Process": "4.3.0",
"System.Reflection": "4.3.0",
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0",
"System.Threading.Thread": "4.3.0",
"System.Xml.XPath.XmlDocument": "4.3.0",
"System.Xml.XmlDocument": "4.3.0"
}
"requested": "[4.2.1, )",
"resolved": "4.2.1",
"contentHash": "kgH8VKsrcZZgNGQXRpVCrM7TnNz9li3b/snH+YmnXUNqsaWa1Xw9EQWHpbzq4Li2FbTjTE/E5N5HdLNXzZ8BpQ=="
},
"RichardSzalay.MockHttp": {
"type": "Direct",
Expand All @@ -68,8 +57,8 @@
},
"Castle.Core": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "b5rRL5zeaau1y/5hIbI+6mGw3cwun16YjkHZnV9RRT5UyUIFsgLmNXJ0YnIN9p8Hw7K7AbG1q1UclQVU3DinAQ==",
"resolved": "4.4.1",
"contentHash": "zanbjWC0Y05gbx4eGXkzVycOQqVOFVeCjVsDSyuao9P4mtN1w3WxxTo193NGC7j3o2u3AJRswaoC6hEbnGACnQ==",
"dependencies": {
"NETStandard.Library": "1.6.1",
"System.Collections.Specialized": "4.3.0",
Expand All @@ -90,23 +79,8 @@
},
"Microsoft.CodeCoverage": {
"type": "Transitive",
"resolved": "16.9.1",
"contentHash": "OEIMvld3rabmyc1L4VvHWOMTEOYrGLbgoVxwAaD8RwX8GT3a1Aal7QpJXLV22f47LpMhSz0uOBerKAd8eI9wNA=="
},
"Microsoft.DotNet.InternalAbstractions": {
"type": "Transitive",
"resolved": "1.0.0",
"contentHash": "AAguUq7YyKk3yDWPoWA8DrLZvURxB/LrDdTn1h5lmPeznkFUpfC3p459w5mQYQE0qpquf/CkSQZ0etiV5vRHFA==",
"dependencies": {
"System.AppContext": "4.1.0",
"System.Collections": "4.0.11",
"System.IO": "4.1.0",
"System.IO.FileSystem": "4.0.1",
"System.Reflection.TypeExtensions": "4.1.0",
"System.Runtime.Extensions": "4.1.0",
"System.Runtime.InteropServices": "4.1.0",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0"
}
"resolved": "17.1.0",
"contentHash": "0N/ZJ71ncCxQWhgtkEYKOgu2oMHa8h1tsOUbhmIKXF8UwtSUCe4vHAsJ3DVcNWRwNfQzSTy263ZE+QF6MdIhhQ=="
},
"Microsoft.Extensions.DependencyInjection": {
"type": "Transitive",
Expand Down Expand Up @@ -200,47 +174,22 @@
},
"Microsoft.TestPlatform.ObjectModel": {
"type": "Transitive",
"resolved": "16.9.1",
"contentHash": "UuS6HBi6pVJDGS5pmf6Mi38oSQVQ4vE5AOmNJzA5WgOUlFmvg9fTq9KCSd5o+UPSVH420t9wthj2Q0M9Yfb+HA==",
"resolved": "17.1.0",
"contentHash": "OMo/FYnKGy3lZEK0gfitskRM3ga/YBt6MyCyFPq0xNLeybGOQ6HnYNAAvzyePo5WPuMiw3LX+HiuRWNjnas1fA==",
"dependencies": {
"NuGet.Frameworks": "5.0.0",
"NuGet.Frameworks": "5.11.0",
"System.Reflection.Metadata": "1.6.0"
}
},
"Microsoft.TestPlatform.TestHost": {
"type": "Transitive",
"resolved": "16.9.1",
"contentHash": "j/lZDlkuoUJ+lRJXOXLJpwUGXmko5/woAPo/hN6QhFRo0J5wscQPoPJ1isvXpB4Iw7x7A3jYllxR5QjV3cMlRw==",
"resolved": "17.1.0",
"contentHash": "JS0JDLniDhIzkSPLHz7N/x1CG8ywJOtwInFDYA3KQvbz+ojGoT5MT2YDVReL1b86zmNRV8339vsTSm/zh0RcMg==",
"dependencies": {
"Microsoft.TestPlatform.ObjectModel": "16.9.1",
"Microsoft.TestPlatform.ObjectModel": "17.1.0",
"Newtonsoft.Json": "9.0.1"
}
},
"Microsoft.Win32.Primitives": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0",
"Microsoft.NETCore.Targets": "1.1.0",
"System.Runtime": "4.3.0"
}
},
"Microsoft.Win32.Registry": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "Lw1/VwLH1yxz6SfFEjVRCN0pnflLEsWgnV4qsdJ512/HhTwnKXUG+zDQ4yTO3K/EJQemGoNaBHX5InISNKTzUQ==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0",
"System.Collections": "4.3.0",
"System.Globalization": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Runtime.Handles": "4.3.0",
"System.Runtime.InteropServices": "4.3.0"
}
},
"NETStandard.Library": {
"type": "Transitive",
"resolved": "2.0.3",
Expand All @@ -251,13 +200,13 @@
},
"Newtonsoft.Json": {
"type": "Transitive",
"resolved": "12.0.3",
"contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg=="
"resolved": "13.0.1",
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
},
"NuGet.Frameworks": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "c5JVjuVAm4f7E9Vj+v09Z9s2ZsqFDjBpcsyS3M9xRo0bEdm/LVZSzLxxNvfvAwRiiE8nwe1h2G4OwiwlzFKXlA=="
"resolved": "5.11.0",
"contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q=="
},
"runtime.native.System": {
"type": "Transitive",
Expand All @@ -268,14 +217,6 @@
"Microsoft.NETCore.Targets": "1.1.0"
}
},
"System.AppContext": {
"type": "Transitive",
"resolved": "4.1.0",
"contentHash": "3QjO4jNV7PdKkmQAVp9atA+usVnKRwI3Kx1nMwJ93T0LcQfx7pKAYk0nKz5wn1oP5iqlhZuy6RXOFdhr7rDwow==",
"dependencies": {
"System.Runtime": "4.1.0"
}
},
"System.Collections": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -321,17 +262,6 @@
"System.Runtime": "4.3.0"
}
},
"System.ComponentModel.EventBasedAsync": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "fCFl8f0XdwA/BuoNrVBB5D0Y48/hv2J+w4xSDdXQitXZsR6UCSOrDVE7TCUraY802ENwcHUnUCv4En8CupDU1g==",
"dependencies": {
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Threading": "4.3.0",
"System.Threading.Tasks": "4.3.0"
}
},
"System.ComponentModel.Primitives": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -382,34 +312,6 @@
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
}
},
"System.Diagnostics.Process": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "J0wOX07+QASQblsfxmIMFc9Iq7KTXYL3zs2G/Xc704Ylv3NpuVdo6gij6V3PGiptTxqsK0K7CdXenRvKUnkA2g==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0",
"Microsoft.Win32.Primitives": "4.3.0",
"Microsoft.Win32.Registry": "4.3.0",
"System.Collections": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
"System.Globalization": "4.3.0",
"System.IO": "4.3.0",
"System.IO.FileSystem": "4.3.0",
"System.IO.FileSystem.Primitives": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Runtime.Handles": "4.3.0",
"System.Runtime.InteropServices": "4.3.0",
"System.Text.Encoding": "4.3.0",
"System.Text.Encoding.Extensions": "4.3.0",
"System.Threading": "4.3.0",
"System.Threading.Tasks": "4.3.0",
"System.Threading.Thread": "4.3.0",
"System.Threading.ThreadPool": "4.3.0",
"runtime.native.System": "4.3.0"
}
},
"System.Diagnostics.TraceSource": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -692,20 +594,6 @@
"System.Runtime.Handles": "4.3.0"
}
},
"System.Runtime.InteropServices.RuntimeInformation": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==",
"dependencies": {
"System.Reflection": "4.3.0",
"System.Reflection.Extensions": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.InteropServices": "4.3.0",
"System.Threading": "4.3.0",
"runtime.native.System": "4.3.0"
}
},
"System.Text.Encoding": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -759,23 +647,6 @@
"resolved": "4.5.4",
"contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg=="
},
"System.Threading.Thread": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "OHmbT+Zz065NKII/ZHcH9XO1dEuLGI1L2k7uYss+9C1jLxTC9kTZZuzUOyXHayRk+dft9CiDf3I/QZ0t8JKyBQ==",
"dependencies": {
"System.Runtime": "4.3.0"
}
},
"System.Threading.ThreadPool": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "k/+g4b7vjdd4aix83sTgC9VG6oXYKAktSfNIJUNGxPEj7ryEOfzHHhfnmsZvjxawwcD9HyWXKCXmPjX8U4zeSw==",
"dependencies": {
"System.Runtime": "4.3.0",
"System.Runtime.Handles": "4.3.0"
}
},
"System.Xml.ReaderWriter": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -815,45 +686,12 @@
"System.Xml.ReaderWriter": "4.3.0"
}
},
"System.Xml.XPath": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "v1JQ5SETnQusqmS3RwStF7vwQ3L02imIzl++sewmt23VGygix04pEH+FCj1yWb+z4GDzKiljr1W7Wfvrx0YwgA==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Diagnostics.Debug": "4.3.0",
"System.Globalization": "4.3.0",
"System.IO": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Threading": "4.3.0",
"System.Xml.ReaderWriter": "4.3.0"
}
},
"System.Xml.XPath.XmlDocument": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "A/uxsWi/Ifzkmd4ArTLISMbfFs6XpRPsXZonrIqyTY70xi8t+mDtvSM5Os0RqyRDobjMBwIDHDL4NOIbkDwf7A==",
"dependencies": {
"System.Collections": "4.3.0",
"System.Globalization": "4.3.0",
"System.IO": "4.3.0",
"System.Resources.ResourceManager": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Extensions": "4.3.0",
"System.Threading": "4.3.0",
"System.Xml.ReaderWriter": "4.3.0",
"System.Xml.XPath": "4.3.0",
"System.Xml.XmlDocument": "4.3.0"
}
},
"DentsuDataLab.AccuRanker": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "5.0.1",
"Microsoft.Extensions.Http": "5.0.0",
"Newtonsoft.Json": "12.0.3"
"Newtonsoft.Json": "13.0.1"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion AccuRanker/Services/BaseAccuRankerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected async Task AuthorizeClient(AuthValues authValues)
var client = await AuthService.AuthorizeClient(authValues);

HttpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", client.AccessToken);
new AuthenticationHeaderValue("Token", authValues.ClientSecret);
}

internal virtual async Task<IEnumerable<T>> GetAllPages<T>(AccuRankerQueryBuilder baseQuery, int pageSize = 500)
Expand Down
6 changes: 3 additions & 3 deletions AccuRanker/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
},
"Newtonsoft.Json": {
"type": "Direct",
"requested": "[12.0.3, )",
"resolved": "12.0.3",
"contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg=="
"requested": "[13.0.1, )",
"resolved": "13.0.1",
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
Expand Down

0 comments on commit e935e85

Please sign in to comment.