File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
src/WebJobs.Script.WebHost/Controllers
test/WebJobs.Script.Tests/Controllers/Admin Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ public IActionResult GetAdminToken()
248
248
return BadRequest ( "Endpoint is only available when running in Linux Container" ) ;
249
249
}
250
250
251
- string requestHeaderToken = SimpleWebTokenHelper . CreateToken ( DateTime . UtcNow . AddHours ( 2 ) ) ;
251
+ string requestHeaderToken = SimpleWebTokenHelper . CreateToken ( DateTime . UtcNow . AddMinutes ( 5 ) ) ;
252
252
return Ok ( requestHeaderToken ) ;
253
253
}
254
254
Original file line number Diff line number Diff line change 4
4
using System . IO ;
5
5
using System . Net ;
6
6
using System . Threading . Tasks ;
7
+ using Microsoft . AspNetCore . Authentication ;
7
8
using Microsoft . AspNetCore . Authorization ;
8
9
using Microsoft . AspNetCore . Mvc ;
9
10
using Microsoft . Azure . WebJobs . Script . WebHost . Controllers ;
10
11
using Microsoft . Azure . WebJobs . Script . WebHost . Management ;
12
+ using Microsoft . Azure . WebJobs . Script . WebHost . Security ;
11
13
using Microsoft . Extensions . Logging ;
12
14
using Microsoft . Extensions . Options ;
13
15
using Microsoft . WebJobs . Script . Tests ;
@@ -104,9 +106,11 @@ public void GetAdminToken_Succeeds()
104
106
// Act
105
107
ObjectResult result = ( ObjectResult ) _hostController . GetAdminToken ( ) ;
106
108
HttpStatusCode resultStatus = ( HttpStatusCode ) result . StatusCode ;
109
+ string token = ( string ) result . Value ;
107
110
108
111
// Assert
109
112
Assert . Equal ( HttpStatusCode . OK , resultStatus ) ;
113
+ Assert . True ( SimpleWebTokenHelper . ValidateToken ( token , new SystemClock ( ) ) ) ;
110
114
}
111
115
}
112
116
You can’t perform that action at this time.
0 commit comments