Accepting a login request without a subject


#1

I’m in the process of implementing an object oriented wrapper around the Hydra REST API.

I wrote some integration tests to check the login/consent flow. For this I tried accepting a login request without any payload at all (all payload fields are optional according to https://www.ory.sh/docs/hydra/sdk/api#schemaacceptloginrequest).

This seems to work since I’m redirected to the next endpoint. However the endpoint of the redirect just closes the connection and logs an error that it failed to validate the OIDC request because of an empty session subject.

INFO[4689] started handling request                      method=GET remote="172.17.0.1:34512" request="/oauth2/auth?response_type=code&client_id=test-client&redirect_uri=http%3A%2F%2Flocalhost&scope=openid+offline&state=iampredictable"
INFO[4689] completed handling request                    measure#http://localhost:4444.latency=160594 method=GET remote="172.17.0.1:34512" request="/oauth2/auth?response_type=code&client_id=test-client&redirect_uri=http%3A%2F%2Flocalhost&scope=openid+offline&state=iampredictable" status=302 text_status=Found took="160.594µs"
INFO[4689] started handling request                      method=GET remote="172.17.0.1:40588" request=/oauth2/auth/requests/login/ffa457cbd90543dca55ca98bef1d7858
INFO[4689] completed handling request                    measure#http://localhost:4444.latency=98857 method=GET remote="172.17.0.1:40588" request=/oauth2/auth/requests/login/ffa457cbd90543dca55ca98bef1d7858 status=200 text_status=OK took="98.857µs"
INFO[4689] started handling request                      method=PUT remote="172.17.0.1:40588" request=/oauth2/auth/requests/login/ffa457cbd90543dca55ca98bef1d7858/accept
INFO[4689] completed handling request                    measure#http://localhost:4444.latency=96532 method=PUT remote="172.17.0.1:40588" request=/oauth2/auth/requests/login/ffa457cbd90543dca55ca98bef1d7858/accept status=200 text_status=OK took="96.532µs"
INFO[4689] started handling request                      method=GET remote="172.17.0.1:34512" request="/oauth2/auth?client_id=test-client&login_verifier=8263c914a70e46cf9072f3ad9bb9affc&redirect_uri=http%3A%2F%2Flocalhost&response_type=code&scope=openid+offline&state=iampredictable"
ERRO[4689] An error occurred                             debug="Failed to validate OpenID Connect request because session subject is empty." description="The authorization server encountered an unexpected condition that prevented it from fulfilling the request" error=server_error
INFO[4689] completed handling request                    measure#http://localhost:4444.latency=207280 method=GET remote="172.17.0.1:34512" request="/oauth2/auth?client_id=test-client&login_verifier=8263c914a70e46cf9072f3ad9bb9affc&redirect_uri=http%3A%2F%2Flocalhost&response_type=code&scope=openid+offline&state=iampredictable" status=302 text_status=Found took="207.28µs"

Is there a use case for having an empty subject e.g. when the login should be remembered? Or is the subject actually required when accepting a login request?


#2

Is there a use case for having an empty subject e.g. when the login should be remembered? Or is the subject actually required when accepting a login request?

The subject can not be empty!


#3

We should probably validate that during consent/login, would you mind opening an issue on GH?


#4

Thanks! Crated an issue: