Commit 9d330308 authored by michael.simon's avatar michael.simon
Browse files

only update attribute source for service called

parent b26c33c4
......@@ -21,16 +21,20 @@ import edu.kit.scc.webreg.exc.RegisterException;
public interface UserUpdateService {
UserEntity updateUser(UserEntity user, Assertion assertion, String executor)
throws RegisterException;
UserEntity updateUserFromIdp(UserEntity user) throws RegisterException;
UserEntity updateUser(UserEntity user, Map<String, List<Object>> attributeMap,
String executor) throws RegisterException;
UserEntity updateUser(UserEntity user,
Map<String, List<Object>> attributeMap, String executor,
ServiceEntity service) throws RegisterException;
UserEntity updateUser(UserEntity user, Assertion assertion,
String executor, ServiceEntity service) throws RegisterException;
UserEntity updateUserFromIdp(UserEntity user, ServiceEntity service)
throws RegisterException;
UserEntity updateUser(UserEntity user,
Map<String, List<Object>> attributeMap, String executor)
throws RegisterException;
}
......@@ -50,7 +50,6 @@ import edu.kit.scc.webreg.exc.NoAssertionException;
import edu.kit.scc.webreg.exc.RegisterException;
import edu.kit.scc.webreg.exc.SamlAuthenticationException;
import edu.kit.scc.webreg.service.ASUserAttrService;
import edu.kit.scc.webreg.service.AttributeSourceService;
import edu.kit.scc.webreg.service.HomeOrgGroupService;
import edu.kit.scc.webreg.service.SamlIdpMetadataService;
import edu.kit.scc.webreg.service.SamlSpConfigurationService;
......@@ -108,7 +107,7 @@ public class UserUpdateServiceImpl implements UserUpdateService {
@Inject
private ApplicationConfig appConfig;
@Override
public UserEntity updateUser(UserEntity user, Map<String, List<Object>> attributeMap, String executor)
throws RegisterException {
......@@ -208,16 +207,22 @@ public class UserUpdateServiceImpl implements UserUpdateService {
}
@Override
public UserEntity updateUser(UserEntity user, Assertion assertion, String executor)
public UserEntity updateUser(UserEntity user, Assertion assertion, String executor, ServiceEntity service)
throws RegisterException {
Map<String, List<Object>> attributeMap = saml2AssertionService.extractAttributes(assertion);
return updateUser(user, attributeMap, executor);
return updateUser(user, attributeMap, executor, service);
}
@Override
public UserEntity updateUserFromIdp(UserEntity user)
throws RegisterException {
return updateUserFromIdp(user, null);
}
@Override
public UserEntity updateUserFromIdp(UserEntity user, ServiceEntity service)
throws RegisterException {
SamlSpConfigurationEntity spEntity = spService.findByEntityId(user.getPersistentSpId());
SamlIdpMetadataEntity idpEntity = idpService.findByEntityId(user.getIdp().getEntityId());
......@@ -266,7 +271,7 @@ public class UserUpdateServiceImpl implements UserUpdateService {
assertion = null;
}
return updateUser(user, assertion, "attribute-query");
return updateUser(user, assertion, "attribute-query", service);
} catch (DecryptionException e) {
updateFail(user, e);
throw new RegisterException(e);
......
......@@ -123,7 +123,7 @@ public class AttributeQueryController {
logger.info("Performing attributequery for {} with {}@{}", new Object[] {user.getEppn(),
user.getPersistentId(), user.getIdp().getEntityId()});
user = userUpdateService.updateUserFromIdp(user);
user = userUpdateService.updateUserFromIdp(user, service);
}
} catch (RegisterException e) {
logger.warn("Could not update user {}: {}", e.getMessage(), user.getEppn());
......
......@@ -433,7 +433,7 @@ public class EcpController {
}
try {
user = userUpdateService.updateUser(user, assertion, caller);
user = userUpdateService.updateUser(user, assertion, caller, service);
} catch (RegisterException e) {
logger.warn("Could not update user {}: {}", e.getMessage(), user.getEppn());
throw new NoItemFoundException("user update failed: " + e.getMessage());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment