use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.
the class ObjectPolicyConfigurationTabPanel method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
PageParameters params = getPage().getPageParameters();
StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
if (val != null && !val.isNull()) {
params.remove(params.getPosition(PageSystemConfiguration.SELECTED_TAB_INDEX));
}
params.set(PageSystemConfiguration.SELECTED_TAB_INDEX, PageSystemConfiguration.CONFIGURATION_TAB_OBJECT_POLICY);
initLayout();
}
use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.
the class ObjectListPanel method getSearchByNameParameterValue.
protected String getSearchByNameParameterValue() {
PageParameters parameters = getPageBase().getPageParameters();
if (parameters == null) {
return null;
}
StringValue value = parameters.get(PageBase.PARAMETER_SEARCH_BY_NAME);
if (value == null) {
return null;
}
return value.toString();
}
use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.
the class PageResetPasswordConfirmation method init.
private void init(final PageParameters pageParameters) {
PageParameters params = pageParameters;
if (params == null) {
params = getPageParameters();
}
OperationResult result = new OperationResult(OPERATION_FINISH_REGISTRATION);
if (params == null) {
LOGGER.error("Confirmation link is not valid. No credentials provided in it");
String msg = createStringResource("PageSelfRegistration.invalid.registration.link").getString();
getSession().error(createStringResource(msg));
result.recordFatalError(msg);
initLayout(result);
return;
}
StringValue userNameValue = params.get(SchemaConstants.USER_ID);
Validate.notEmpty(userNameValue.toString());
StringValue tokenValue = params.get(SchemaConstants.TOKEN);
Validate.notEmpty(tokenValue.toString());
UsernamePasswordAuthenticationToken token = authenticateUser(userNameValue.toString(), tokenValue.toString(), result);
if (token == null) {
initLayout(result);
return;
} else {
// SecurityContextHolder.getContext().setAuthentication(token);
MidPointPrincipal principal = (MidPointPrincipal) token.getPrincipal();
Collection<Authorization> authz = principal.getAuthorities();
if (authz != null) {
for (Authorization authzI : authz) {
authzI.getAction().removeIf(action -> action.contains(AuthorizationConstants.NS_AUTHORIZATION_UI));
}
}
AuthorizationType authorizationType = new AuthorizationType();
authorizationType.getAction().add(AuthorizationConstants.AUTZ_UI_SELF_CREDENTIALS_URL);
Authorization selfServiceCredentialsAuthz = new Authorization(authorizationType);
authz.add(selfServiceCredentialsAuthz);
AuthenticationSequenceType sequence = SecurityPolicyUtil.createPasswordResetSequence();
Map<Class<?>, Object> sharedObjects = new HashMap<>();
AuthenticationModulesType modules = new AuthenticationModulesType();
LoginFormAuthenticationModuleType loginForm = new LoginFormAuthenticationModuleType();
loginForm.name(SecurityPolicyUtil.DEFAULT_MODULE_NAME);
modules.loginForm(loginForm);
AuthModule authModule = null;
AuthenticationChannel channel = null;
try {
channel = channelFactory.createAuthChannel(sequence.getChannel());
authModule = moduleFactory.createModuleFilter(loginForm, sequence.getChannel().getUrlSuffix(), null, sharedObjects, modules, null, channel);
} catch (Exception e) {
LOGGER.error("Couldn't build filter for module moduleFactory", e);
}
MidpointAuthentication mpAuthentication = new MidpointAuthentication(sequence);
List<AuthModule> authModules = new ArrayList<>();
authModules.add(authModule);
mpAuthentication.setAuthModules(authModules);
mpAuthentication.setSessionId(Session.get().getId());
ModuleAuthentication moduleAuthentication = authModule.getBaseModuleAuthentication();
moduleAuthentication.setAuthentication(token);
moduleAuthentication.setState(AuthenticationModuleState.SUCCESSFULLY);
mpAuthentication.addAuthentications(moduleAuthentication);
mpAuthentication.setPrincipal(principal);
mpAuthentication.setAuthorities(token.getAuthorities());
mpAuthentication.setAuthenticationChannel(channel);
SecurityContextHolder.getContext().setAuthentication(mpAuthentication);
setResponsePage(PageResetPassword.class);
}
initLayout(result);
}
use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.
the class LeftMenuPanel method createDashboardMenuItem.
private MenuItem createDashboardMenuItem(CompiledDashboardType dashboard) {
Validate.notNull(dashboard, "Dashboard object is null");
if (!WebComponentUtil.getElementVisibility(dashboard.getVisibility())) {
return null;
}
String label = getDashboardLabel(dashboard);
StringValue dashboardOidParam = getPageBase().getPageParameters().get(OnePageParameterEncoder.PARAMETER);
boolean active = false;
if (dashboardOidParam != null) {
active = dashboard.getOid().equals(dashboardOidParam.toString());
}
return new MenuItem(label, PageDashboardConfigurable.class, createDashboardPageParameters(dashboard), active);
}
use of org.apache.wicket.util.string.StringValue in project midpoint by Evolveum.
the class LeftMenuPanel method getSelectedTabForConfiguration.
private int getSelectedTabForConfiguration(WebPage page) {
PageParameters params = page.getPageParameters();
StringValue val = params.get(PageSystemConfiguration.SELECTED_TAB_INDEX);
String value = null;
if (val != null && !val.isNull()) {
value = val.toString();
}
return StringUtils.isNumeric(value) ? Integer.parseInt(value) : PageSystemConfiguration.CONFIGURATION_TAB_BASIC;
}
Aggregations