Skip to content

Commit

Permalink
Merge pull request #1157 from DuendeSoftware/joe/always-emit-sid-claim
Browse files Browse the repository at this point in the history
Always emit the sid claim in id tokens
  • Loading branch information
brockallen authored Feb 2, 2023
2 parents 2f5eee2 + ab3ad2f commit 84bc142
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/IdentityServer/Validation/Default/AuthorizeRequestValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -874,27 +874,24 @@ private async Task<AuthorizeRequestValidationResult> ValidateOptionalParametersA
}

//////////////////////////////////////////////////////////
// check session cookie
// session id
//////////////////////////////////////////////////////////
if (_options.Endpoints.EnableCheckSessionEndpoint)
if (request.Subject.IsAuthenticated())
{
if (request.Subject.IsAuthenticated())
var sessionId = await _userSession.GetSessionIdAsync();
if (sessionId.IsPresent())
{
var sessionId = await _userSession.GetSessionIdAsync();
if (sessionId.IsPresent())
{
request.SessionId = sessionId;
}
else
{
LogError("Check session endpoint enabled, but SessionId is missing", request);
}
request.SessionId = sessionId;
}
else
{
request.SessionId = ""; // empty string for anonymous users
LogError("SessionId is missing", request);
}
}
else
{
request.SessionId = ""; // empty string for anonymous users
}

return Valid(request);
}
Expand Down

0 comments on commit 84bc142

Please sign in to comment.