11using Microsoft . AspNetCore . Mvc ;
22using Microsoft . AspNetCore . Mvc . RazorPages ;
33using Microsoft . Identity . Web ;
4+ using TokenManagement . AadTokenPolicies ;
45
56namespace TokenManagement . Pages . AadTokenPolicies ;
67
7- [ AuthorizeForScopes ( Scopes = new string [ ] { "Policy.Read.All" , "Policy.ReadWrite.ApplicationConfiguration" , "Application.ReadWrite.All" } ) ]
8+ [ AuthorizeForScopes ( Scopes = [ "Policy.Read.All" , "Policy.ReadWrite.ApplicationConfiguration" , "Application.ReadWrite.All" ] ) ]
89public class DetailsModel : PageModel
910{
1011 private readonly TokenLifetimePolicyGraphApiService _tokenLifetimePolicyGraphApiService ;
@@ -14,9 +15,8 @@ public DetailsModel(TokenLifetimePolicyGraphApiService tokenLifetimePolicyGraphA
1415 _tokenLifetimePolicyGraphApiService = tokenLifetimePolicyGraphApiService ;
1516 }
1617
17- public TokenLifetimePolicyDto TokenLifetimePolicyDto { get ; set ; }
18-
19- public List < PolicyAssignedApplicationsDto > PolicyAssignedApplications { get ; set ; }
18+ public TokenLifetimePolicyDto TokenLifetimePolicyDto { get ; set ; } = new ( ) ;
19+ public List < PolicyAssignedApplicationsDto > PolicyAssignedApplications { get ; set ; } = [ ] ;
2020
2121 public async Task < IActionResult > OnGetAsync ( string id )
2222 {
@@ -28,7 +28,7 @@ public async Task<IActionResult> OnGetAsync(string id)
2828 var policy = await _tokenLifetimePolicyGraphApiService . GetPolicy ( id ) ;
2929 TokenLifetimePolicyDto = new TokenLifetimePolicyDto
3030 {
31- Definition = policy . Definition . FirstOrDefault ( ) ,
31+ Definition = policy . Definition . FirstOrDefault ( ) ! ,
3232 DisplayName = policy . DisplayName ,
3333 IsOrganizationDefault = policy . IsOrganizationDefault . GetValueOrDefault ( ) ,
3434 Id = policy . Id
@@ -43,18 +43,18 @@ public async Task<IActionResult> OnGetAsync(string id)
4343 PolicyAssignedApplications = applications . CurrentPage . Select ( app => new PolicyAssignedApplicationsDto
4444 {
4545 Id = app . Id ,
46- DisplayName = ( app as Microsoft . Graph . Application ) . DisplayName ,
47- AppId = ( app as Microsoft . Graph . Application ) . AppId ,
48- SignInAudience = ( app as Microsoft . Graph . Application ) . SignInAudience
46+ DisplayName = ( app as Microsoft . Graph . Application ) ! . DisplayName ,
47+ AppId = ( app as Microsoft . Graph . Application ) ! . AppId ,
48+ SignInAudience = ( app as Microsoft . Graph . Application ) ! . SignInAudience
4949
5050 } ) . ToList ( ) ;
5151 return Page ( ) ;
5252 }
5353
5454 public async Task < IActionResult > OnPostAsync ( )
5555 {
56- string ? appId = Request . Form [ "item.AppId" ] ;
57- string ? policyId = Request . Form [ "TokenLifetimePolicyDto.Id" ] ;
56+ string ? appId = Request . Form [ "item.AppId" ] ! ;
57+ string ? policyId = Request . Form [ "TokenLifetimePolicyDto.Id" ] ! ;
5858
5959 if ( ! ModelState . IsValid )
6060 {
0 commit comments