use of com.evolveum.midpoint.TerminateSessionEvent in project midpoint by Evolveum.
the class InternalsLoggedInUsersPanel method terminateSessions.
private void terminateSessions(AjaxRequestTarget target, F selectedObject) {
List<String> selected = getSelectedObjects(selectedObject);
if (CollectionUtils.isEmpty(selected)) {
getSession().warn(getString("InternalsLoggedInUsersPanel.expireSession.warn"));
target.add(getPageBase().getFeedbackPanel());
return;
}
Task task = getPageBase().createSimpleTask(OPERATION_TERMINATE_SESSIONS);
TerminateSessionEvent details = new TerminateSessionEvent();
details.setPrincipalOids(selected);
getPageBase().getModelInteractionService().terminateSessions(details, task, task.getResult());
getSession().success(getString("InternalsLoggedInUsersPanel.expireSession.success"));
target.add(getPageBase().getFeedbackPanel());
}
use of com.evolveum.midpoint.TerminateSessionEvent in project midpoint by Evolveum.
the class TestAbstractAuthenticationEvaluator method initSystem.
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);
modelService.postInit(initResult);
// System Configuration
try {
repoAddObjectFromFile(SYSTEM_CONFIGURATION_FILE, initResult);
} catch (ObjectAlreadyExistsException e) {
throw new ObjectAlreadyExistsException("System configuration already exists in repository;" + "looks like the previous test haven't cleaned it up", e);
}
repoAddObjectFromFile(SECURITY_POLICY_FILE, initResult);
// Administrator
repoAddObjectFromFile(ROLE_SUPERUSER_FILE, initResult);
PrismObject<UserType> userAdministrator = repoAddObjectFromFile(USER_ADMINISTRATOR_FILE, initResult);
login(userAdministrator);
// Users
repoAddObjectFromFile(USER_JACK_FILE, UserType.class, initResult).asObjectable();
repoAddObjectFromFile(USER_GUYBRUSH_FILE, UserType.class, initResult).asObjectable();
messages = new MessageSourceAccessor(messageSource);
((AuthenticationEvaluatorImpl) getAuthenticationEvaluator()).setPrincipalManager(new GuiProfiledPrincipalManager() {
@Override
public <F extends FocusType, O extends ObjectType> PrismObject<F> resolveOwner(PrismObject<O> object) throws CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
return focusProfileService.resolveOwner(object);
}
@Override
public void updateFocus(MidPointPrincipal principal, Collection<? extends ItemDelta<?, ?>> itemDeltas) {
focusProfileService.updateFocus(principal, itemDeltas);
}
@Override
public GuiProfiledPrincipal getPrincipal(PrismObject<? extends FocusType> user) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
return getPrincipal(user, null, null);
}
@Override
public GuiProfiledPrincipal getPrincipal(PrismObject<? extends FocusType> user, AuthorizationTransformer authorizationLimiter, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
GuiProfiledPrincipal principal = focusProfileService.getPrincipal(user);
addFakeAuthorization(principal);
return principal;
}
@Override
public GuiProfiledPrincipal getPrincipal(String username, Class<? extends FocusType> clazz) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
GuiProfiledPrincipal principal = focusProfileService.getPrincipal(username, clazz);
addFakeAuthorization(principal);
return principal;
}
@Override
public GuiProfiledPrincipal getPrincipalByOid(String oid, Class<? extends FocusType> clazz) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
GuiProfiledPrincipal principal = focusProfileService.getPrincipalByOid(oid, clazz);
addFakeAuthorization(principal);
return principal;
}
// TODO test maybe later?
@Override
public List<UserSessionManagementType> getLocalLoggedInPrincipals() {
return null;
}
@Override
public void terminateLocalSessions(TerminateSessionEvent terminateSessionEvent) {
// TOTO test it
}
});
}
Aggregations