Skip to content

Commit

Permalink
Ignore remote exceptions during login
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Apr 16, 2024
1 parent bea24bc commit 01b497c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>access</artifactId>
<version>0.0.12-SNAPSHOT</version>
<version>0.0.12</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>access-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.openconext</groupId>
<artifactId>access</artifactId>
<version>0.0.12-SNAPSHOT</version>
<version>0.0.12</version>
<packaging>pom</packaging>
<name>access</name>
<description>SURFconext Invite</description>
Expand Down
2 changes: 1 addition & 1 deletion provisioning-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>access</artifactId>
<version>0.0.12-SNAPSHOT</version>
<version>0.0.12</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>provisioning-mock</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>access</artifactId>
<version>0.0.12-SNAPSHOT</version>
<version>0.0.12</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>access-server</artifactId>
Expand Down
12 changes: 11 additions & 1 deletion server/src/main/java/access/security/CustomOidcUserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import access.provision.ProvisioningService;
import access.repository.UserRepository;
import lombok.Getter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest;
import org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService;
import org.springframework.security.oauth2.client.userinfo.OAuth2UserService;
Expand All @@ -22,6 +24,8 @@

public class CustomOidcUserService implements OAuth2UserService<OidcUserRequest, OidcUser> {

private static final Log LOG = LogFactory.getLog(CustomOidcUserService.class);

@Getter
private final Manage manage;
private final ProvisioningService provisioningService;
Expand Down Expand Up @@ -68,7 +72,13 @@ public OidcUser loadUser(OidcUserRequest userRequest) throws OAuth2Authenticatio
optionalUser.ifPresent(user -> {
boolean changed = user.updateAttributes(newClaims);
if (changed) {
provisioningService.updateUserRequest(user);
try {
provisioningService.updateUserRequest(user);
} catch (RuntimeException e) {
//We choose to ignore these
LOG.error("Error in updateUserRequest", e);
}

}
userRepository.save(user);
});
Expand Down
2 changes: 1 addition & 1 deletion welcome/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>access</artifactId>
<version>0.0.12-SNAPSHOT</version>
<version>0.0.12</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>access-welcome</artifactId>
Expand Down

0 comments on commit 01b497c

Please sign in to comment.