List of usage examples for org.apache.wicket.request Url getHost
public String getHost()
From source file:com.evolveum.midpoint.web.security.MidPointAuthWebSession.java
License:Apache License
private void auditEvent(Authentication authentication, String username, OperationResultStatus status) { MidPointPrincipal principal = SecurityUtils.getPrincipalUser(authentication); PrismObject<UserType> user = principal != null ? principal.getUser().asPrismObject() : null; Task task = taskManager.createTaskInstance(); task.setOwner(user);//from w w w .j a v a2 s. c o m task.setChannel(SchemaConstants.CHANNEL_GUI_USER_URI); AuditEventRecord record = new AuditEventRecord(AuditEventType.CREATE_SESSION, AuditEventStage.REQUEST); record.setInitiator(user); record.setParameter(username); record.setChannel(SchemaConstants.CHANNEL_GUI_USER_URI); Url url = RequestCycle.get().getRequest().getUrl(); record.setHostIdentifier(url.getHost()); record.setTimestamp(System.currentTimeMillis()); Session session = ThreadContext.getSession(); if (session != null) { record.setSessionIdentifier(session.getId()); } record.setOutcome(status); auditService.audit(record, task); }
From source file:com.przemo.projectmanagementweb.pages.RegisterUser.java
@Override protected void initComponents() { Form f = new Form("form") { @Override/*from w ww. j a v a2s .c om*/ protected void onSubmit() { Users user = new Users(); user.setEmail(email); //TODO: user roles will haveto be managed somehow as well user.setRole(new Role(1, "Developer")); Url reqUrl = getRequestCycle().getRequest().getUrl(); userManagementService.registerUser(user, pass1, "http://" + reqUrl.getHost() + ":8080/ProjectManagementWeb-0.1"); setResponsePage(UserRegistered.class); } }; TextField p1 = new PasswordTextField("pass1", new PropertyModel(this, "pass1")); TextField p2 = new PasswordTextField("pass2", new PropertyModel(this, "pass2")); f.add(new TextField("email", new PropertyModel(this, "email")).add(EmailAddressValidator.getInstance())); f.add(p1); f.add(p2); f.add(new EqualPasswordInputValidator(p1, p2)); add(f); }