Skip to content

Commit 5a75f1c

Browse files
[bugfix] NullPointerException in IntrospectionEndpoint.post when the Authorization header is missing
1 parent 28515b8 commit 5a75f1c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/com/authlete/jaxrs/server/api/IntrospectionEndpoint.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public Response post(
7777
BasicCredentials credentials = BasicCredentials.parse(authorization);
7878

7979
// Fetch the information about the resource server from DB.
80-
ResourceServerEntity rsEntity = ResourceServerDao.get(credentials.getUserId());
80+
ResourceServerEntity rsEntity = getResourceServer(credentials);
8181

8282
// If failed to authenticate the resource server.
8383
if (authenticateResourceServer(rsEntity, credentials) == false)
@@ -110,6 +110,17 @@ private Params buildParams(
110110
}
111111

112112

113+
private ResourceServerEntity getResourceServer(BasicCredentials credentials)
114+
{
115+
if (credentials == null)
116+
{
117+
return null;
118+
}
119+
120+
return ResourceServerDao.get(credentials.getUserId());
121+
}
122+
123+
113124
private boolean authenticateResourceServer(
114125
ResourceServerEntity rsEntity, BasicCredentials credentials)
115126
{

0 commit comments

Comments
 (0)