File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public class TasksController : ApiController
3333 {
3434 HasRequiredScopes ( ReadPermission ) ;
3535
36- var owner = CheckClaimMatch ( objectIdElement ) ;
36+ var owner = CheckClaimMatch ( ClaimTypes . NameIdentifier ) ;
3737
3838 IEnumerable < Models . Task > userTasks = db . Where ( t => t . Owner == owner ) ;
3939 return userTasks ;
@@ -49,7 +49,7 @@ public void Post(Models.Task task)
4949 if ( String . IsNullOrEmpty ( task . Text ) )
5050 throw new WebException ( "Please provide a task description" ) ;
5151
52- var owner = CheckClaimMatch ( objectIdElement ) ;
52+ var owner = CheckClaimMatch ( ClaimTypes . NameIdentifier ) ;
5353
5454 task . Id = taskId ++ ;
5555 task . Owner = owner ;
@@ -65,7 +65,7 @@ public void Delete(int id)
6565 {
6666 HasRequiredScopes ( WritePermission ) ;
6767
68- var owner = CheckClaimMatch ( objectIdElement ) ;
68+ var owner = CheckClaimMatch ( ClaimTypes . NameIdentifier ) ;
6969
7070 Models . Task task = db . Where ( t => t . Owner . Equals ( owner ) && t . Id . Equals ( id ) ) . FirstOrDefault ( ) ;
7171 db . Remove ( task ) ;
Original file line number Diff line number Diff line change @@ -54,11 +54,11 @@ public static string GetB2CMsalAccountId(this ClaimsPrincipal claimsPrincipal)
5454 /// <returns>Unique object ID of the identity, or <c>null</c> if it cannot be found</returns>
5555 public static string GetObjectId ( this ClaimsPrincipal claimsPrincipal )
5656 {
57- var objIdclaim = claimsPrincipal . FindFirst ( ClaimConstants . ObjectId ) ;
57+ var objIdclaim = claimsPrincipal . FindFirst ( ClaimTypes . NameIdentifier ) ;
5858
5959 if ( objIdclaim == null )
6060 {
61- objIdclaim = claimsPrincipal . FindFirst ( "oid " ) ;
61+ objIdclaim = claimsPrincipal . FindFirst ( "sub " ) ;
6262 }
6363
6464 return objIdclaim != null ? objIdclaim . Value : string . Empty ;
You can’t perform that action at this time.
0 commit comments