Skip to content

Commit 6b13611

Browse files
committed
OIDC: improve error handling for missing claim
1 parent fd222a4 commit 6b13611

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/eu/openanalytics/containerproxy/auth/impl/OpenIDAuthenticationBackend.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class OpenIDAuthenticationBackend implements IAuthenticationBackend {
8181

8282
private static final String ENV_TOKEN_NAME = "SHINYPROXY_OIDC_ACCESS_TOKEN";
8383

84-
private Logger log = LogManager.getLogger(OpenIDAuthenticationBackend.class);
84+
private final Logger log = LogManager.getLogger(OpenIDAuthenticationBackend.class);
8585

8686
@Inject
8787
private Environment environment;
@@ -267,7 +267,11 @@ public OidcUser loadUser(OidcUserRequest userRequest) throws OAuth2Authenticatio
267267
try {
268268
user = super.loadUser(userRequest);
269269
} catch (IllegalArgumentException ex) {
270+
log.warn("Error while loading user info: {}", ex.getMessage());
270271
throw new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.INVALID_REQUEST), "Error while loading user info", ex);
272+
} catch (OAuth2AuthenticationException ex) {
273+
log.warn("Error while loading user info: {}", ex.getMessage());
274+
throw ex;
271275
}
272276

273277
String nameAttributeKey = environment.getProperty("proxy.openid.username-attribute", "email");

0 commit comments

Comments
 (0)