Skip to content

Instantly share code, notes, and snippets.

@janhoy
Last active May 29, 2020 07:30
Show Gist options
  • Save janhoy/8797aed00819b290fdd828e9c7a98ae9 to your computer and use it in GitHub Desktop.
Save janhoy/8797aed00819b290fdd828e9c7a98ae9 to your computer and use it in GitHub Desktop.
Solr JWT responses

Some error responses from Solr JWT

There are many other corner cases, but here are some of the most common authentication responses from Solr.

If Authorization is configured in Solr, and a call is rejected by authorization, then a HTTP 403 response is returned

Token expired

HTTP/2 401 
content-security-policy: default-src 'none'; base-uri 'none'; connect-src 'self'; form-action 'self'; font-src 'self'; frame-ancestors 'none'; img-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; worker-src 'self';
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
www-authenticate: Bearer realm="solr-jwt", error="invalid_token", error_description="JWT token expired"
x-solr-authdata: ewogICJzY29wZSI6InNvbHIiLAogICJyZWRpcmVjdF91cmlzIjpbImh0dHBzOi8vc29scjo4OTgzL3NvbHIvIl0sCiAgImF1dGhvcml6YXRpb25FbmRwb2ludCI6Imh0dHBzOi8vaWRwOjgwODEvYzJpZC1sb2dpbi8iLAogICJjbGllbnRfaWQiOiJ0eXJyaWV6dXBmN3JhIn0=
cache-control: must-revalidate,no-cache,no-store
content-type: text/html;charset=iso-8859-1

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 JWT token expired</title>
</head>
<body><h2>HTTP ERROR 401 JWT token expired</h2>
<table>
<tr><th>URI:</th><td>/solr/admin/info/health</td></tr>
<tr><th>STATUS:</th><td>401</td></tr>
<tr><th>MESSAGE:</th><td>JWT token expired</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>
</table>

</body>
</html>

Missing token

HTTP/2 401 
content-security-policy: default-src 'none'; base-uri 'none'; connect-src 'self'; form-action 'self'; font-src 'self'; frame-ancestors 'none'; img-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; worker-src 'self';
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
www-authenticate: Bearer realm="solr-jwt"
x-solr-authdata: ewogICJzY29wZSI6InNvbHIiLAogICJyZWRpcmVjdF91cmlzIjpbImh0dHBzOi8vc29scjo4OTgzL3NvbHIvIl0sCiAgImF1dGhvcml6YXRpb25FbmRwb2ludCI6Imh0dHBzOi8vaWRwOjgwODEvYzJpZC1sb2dpbi8iLAogICJjbGllbnRfaWQiOiJ0eXJyaWV6dXBmN3JhIn0=
cache-control: must-revalidate,no-cache,no-store
content-type: text/html;charset=iso-8859-1

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 Require authentication</title>
</head>
<body><h2>HTTP ERROR 401 Require authentication</h2>
<table>
<tr><th>URI:</th><td>/solr/admin/info/health</td></tr>
<tr><th>STATUS:</th><td>401</td></tr>
<tr><th>MESSAGE:</th><td>Require authentication</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>
</table>

</body>
</html>

JWT invalid

HTTP/2 400 
content-security-policy: default-src 'none'; base-uri 'none'; connect-src 'self'; form-action 'self'; font-src 'self'; frame-ancestors 'none'; img-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; worker-src 'self';
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
www-authenticate: Bearer realm="solr-jwt", error="invalid_request", error_description="Invalid JWT"
x-solr-authdata: ewogICJzY29wZSI6InNvbHIiLAogICJyZWRpcmVjdF91cmlzIjpbImh0dHBzOi8vc29scjo4OTgzL3NvbHIvIl0sCiAgImF1dGhvcml6YXRpb25FbmRwb2ludCI6Imh0dHBzOi8vaWRwOjgwODEvYzJpZC1sb2dpbi8iLAogICJjbGllbnRfaWQiOiJ0eXJyaWV6dXBmN3JhIn0=
cache-control: must-revalidate,no-cache,no-store
content-type: text/html;charset=iso-8859-1

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 400 Invalid JWT</title>
</head>
<body><h2>HTTP ERROR 400 Invalid JWT</h2>
<table>
<tr><th>URI:</th><td>/solr/admin/info/health</td></tr>
<tr><th>STATUS:</th><td>400</td></tr>
<tr><th>MESSAGE:</th><td>Invalid JWT</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>
</table>

</body>
</html>

JWT validation failed

HTTP/2 401 
content-security-policy: default-src 'none'; base-uri 'none'; connect-src 'self'; form-action 'self'; font-src 'self'; frame-ancestors 'none'; img-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; worker-src 'self';
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
www-authenticate: Bearer realm="solr-jwt", error="invalid_token", error_description="JWT validation failed"
x-solr-authdata: ewogICJzY29wZSI6InNvbHIiLAogICJyZWRpcmVjdF91cmlzIjpbImh0dHBzOi8vc29scjo4OTgzL3NvbHIvIl0sCiAgImF1dGhvcml6YXRpb25FbmRwb2ludCI6Imh0dHBzOi8vaWRwOjgwODEvYzJpZC1sb2dpbi8iLAogICJjbGllbnRfaWQiOiJ0eXJyaWV6dXBmN3JhIn0=
cache-control: must-revalidate,no-cache,no-store
content-type: text/html;charset=iso-8859-1

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 JWT validation failed</title>
</head>
<body><h2>HTTP ERROR 401 JWT validation failed</h2>
<table>
<tr><th>URI:</th><td>/solr/admin/info/health</td></tr>
<tr><th>STATUS:</th><td>401</td></tr>
<tr><th>MESSAGE:</th><td>JWT validation failed</td></tr>
<tr><th>SERVLET:</th><td>default</td></tr>
</table>

</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment