user info fetcher cache throws error instead of returning null (as per library contract), closes #1144
parent
bea3af2470
commit
275c1b7e1c
|
@ -18,6 +18,7 @@ package org.mitre.openid.connect.client;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -89,7 +90,7 @@ public class UserInfoFetcher {
|
|||
this.factory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||
}
|
||||
|
||||
public UserInfo load(final PendingOIDCAuthenticationToken token) {
|
||||
public UserInfo load(final PendingOIDCAuthenticationToken token) throws URISyntaxException {
|
||||
|
||||
ServerConfiguration serverConfiguration = token.getServerConfiguration();
|
||||
|
||||
|
@ -103,8 +104,6 @@ public class UserInfoFetcher {
|
|||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
String userInfoString = null;
|
||||
|
||||
if (serverConfiguration.getUserInfoTokenMethod() == null || serverConfiguration.getUserInfoTokenMethod().equals(UserInfoTokenMethod.HEADER)) {
|
||||
|
@ -143,12 +142,8 @@ public class UserInfoFetcher {
|
|||
|
||||
return userInfo;
|
||||
} else {
|
||||
// didn't get anything, return null
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Error fetching userinfo", e);
|
||||
return null;
|
||||
// didn't get anything throw exception
|
||||
throw new IllegalArgumentException("Unable to load user info");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue