Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always emit the sid claim in id tokens #1157

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is normally possible to not have a session id, so I think logging this as an error and then continuing is reasonable.

}
}
else
{
request.SessionId = ""; // empty string for anonymous users
}

return Valid(request);
}
Expand Down