File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public class TasksController : ApiController
33
33
{
34
34
HasRequiredScopes ( ReadPermission ) ;
35
35
36
- var owner = CheckClaimMatch ( objectIdElement ) ;
36
+ var owner = CheckClaimMatch ( ClaimTypes . NameIdentifier ) ;
37
37
38
38
IEnumerable < Models . Task > userTasks = db . Where ( t => t . Owner == owner ) ;
39
39
return userTasks ;
@@ -49,7 +49,7 @@ public void Post(Models.Task task)
49
49
if ( String . IsNullOrEmpty ( task . Text ) )
50
50
throw new WebException ( "Please provide a task description" ) ;
51
51
52
- var owner = CheckClaimMatch ( objectIdElement ) ;
52
+ var owner = CheckClaimMatch ( ClaimTypes . NameIdentifier ) ;
53
53
54
54
task . Id = taskId ++ ;
55
55
task . Owner = owner ;
@@ -65,7 +65,7 @@ public void Delete(int id)
65
65
{
66
66
HasRequiredScopes ( WritePermission ) ;
67
67
68
- var owner = CheckClaimMatch ( objectIdElement ) ;
68
+ var owner = CheckClaimMatch ( ClaimTypes . NameIdentifier ) ;
69
69
70
70
Models . Task task = db . Where ( t => t . Owner . Equals ( owner ) && t . Id . Equals ( id ) ) . FirstOrDefault ( ) ;
71
71
db . Remove ( task ) ;
Original file line number Diff line number Diff line change @@ -54,11 +54,11 @@ public static string GetB2CMsalAccountId(this ClaimsPrincipal claimsPrincipal)
54
54
/// <returns>Unique object ID of the identity, or <c>null</c> if it cannot be found</returns>
55
55
public static string GetObjectId ( this ClaimsPrincipal claimsPrincipal )
56
56
{
57
- var objIdclaim = claimsPrincipal . FindFirst ( ClaimConstants . ObjectId ) ;
57
+ var objIdclaim = claimsPrincipal . FindFirst ( ClaimTypes . NameIdentifier ) ;
58
58
59
59
if ( objIdclaim == null )
60
60
{
61
- objIdclaim = claimsPrincipal . FindFirst ( "oid " ) ;
61
+ objIdclaim = claimsPrincipal . FindFirst ( "sub " ) ;
62
62
}
63
63
64
64
return objIdclaim != null ? objIdclaim . Value : string . Empty ;
You can’t perform that action at this time.
0 commit comments