File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/WebJobs.Script.Scaling Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ namespace Microsoft.Azure.WebJobs.Script.Scaling
14
14
[ SuppressMessage ( "Microsoft.Naming" , "CA1704:IdentifiersShouldBeSpelledCorrectly" , Justification = "By design" ) ]
15
15
public static class ScaleUtils
16
16
{
17
+ public const string Purpose = "ScaleManager" ;
18
+
17
19
[ SuppressMessage ( "Microsoft.Naming" , "CA1704:IdentifiersShouldBeSpelledCorrectly" , Justification = "By design" ) ]
18
20
public static bool WorkerEquals ( IWorkerInfo src , IWorkerInfo dst )
19
21
{
@@ -87,14 +89,14 @@ public static string ToDisplayString(this IEnumerable<string> values)
87
89
public static string GetToken ( DateTime expiredUtc )
88
90
{
89
91
var bytes = BitConverter . GetBytes ( expiredUtc . Ticks ) ;
90
- var encrypted = MachineKey . Protect ( bytes ) ;
92
+ var encrypted = MachineKey . Protect ( bytes , Purpose ) ;
91
93
return Convert . ToBase64String ( encrypted ) ;
92
94
}
93
95
94
96
public static void ValidateToken ( string token )
95
97
{
96
98
var encrypted = Convert . FromBase64String ( token ) ;
97
- var bytes = MachineKey . Unprotect ( encrypted ) ;
99
+ var bytes = MachineKey . Unprotect ( encrypted , Purpose ) ;
98
100
var ticks = BitConverter . ToInt64 ( bytes , 0 ) ;
99
101
var expiredUtc = new DateTime ( ticks , DateTimeKind . Utc ) ;
100
102
You can’t perform that action at this time.
0 commit comments