List of usage examples for org.apache.wicket.authentication IAuthenticationStrategy remove
void remove();
From source file:com.barchart.kerberos.server.ui.panel.login.LoginPanel.java
License:Apache License
/** * Try to sign-in with remembered credentials. * /*from w ww. j ava 2 s . c o m*/ * @see #setRememberMe(boolean) */ @Override protected void onConfigure() { // logged in already? if (isSignedIn() == false) { final IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); // get username and password from persistence store final String[] data = authenticationStrategy.load(); if ((data != null) && (data.length > 1)) { // try to sign in the user if (signIn(data[0], data[1])) { username = data[0]; password = data[1]; onSignInRemembered(); } else { // the loaded credentials are wrong. erase them. authenticationStrategy.remove(); } } } super.onConfigure(); }
From source file:de.widone.web.authentication.panel.signin.BootstrapSignInPanel.java
License:Apache License
/** * @see org.apache.wicket.Component#onBeforeRender() *///from www . jav a 2 s .c o m @Override protected void onBeforeRender() { // logged in already? if (isSignedIn() == false) { IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); // get username and password from persistence store String[] data = authenticationStrategy.load(); if ((data != null) && (data.length > 1)) { // try to sign in the user if (signIn(data[0], data[1])) { username = data[0]; password = data[1]; // logon successful. Continue to the original destination if (!continueToOriginalDestination()) { // Ups, no original destination. Go to the home page throw new RestartResponseException( getSession().getPageFactory().newPage(getApplication().getHomePage())); } } else { // the loaded credentials are wrong. erase them. authenticationStrategy.remove(); } } } // don't forget super.onBeforeRender(); }
From source file:jp.xet.uncommons.wicket.bootstrap.SignInPanel.java
License:Apache License
@Override protected void onBeforeRender() { // logged in already? if (isSignedIn() == false) { IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); // get username and password from persistence store String[] data = authenticationStrategy.load(); if ((data != null) && (data.length > 1)) { // try to sign in the user if (signIn(data[0], data[1])) { username = data[0];//from w w w . j a v a 2 s . co m password = data[1]; // logon successful. Continue to the original destination if (continueToOriginalDestination() == false) { // Ups, no original destination. Go to the home page throw new RestartResponseException( getSession().getPageFactory().newPage(getApplication().getHomePage())); } } else { // the loaded credentials are wrong. erase them. authenticationStrategy.remove(); } } } // don't forget super.onBeforeRender(); }
From source file:org.apache.openmeetings.web.app.WebSession.java
License:Apache License
@Override public boolean isSignedIn() { if (userId == null) { IAuthenticationStrategy strategy = getAuthenticationStrategy(); // get username and password from persistence store String[] data = strategy.load(); if (data != null && data.length > 3 && data[2] != null) { Long domainId = null; try { domainId = Long.valueOf(data[3]); } catch (Exception e) { //no-op }// w w w .ja va 2 s.c om // try to sign in the user if (!signIn(data[0], data[1], Type.valueOf(data[2]), domainId)) { // the loaded credentials are wrong. erase them. strategy.remove(); } } } return userId != null && userId.longValue() > 0; }
From source file:org.apache.syncope.client.console.pages.Login.java
License:Apache License
public Login(final PageParameters parameters) { super(parameters); setStatelessHint(true);/*from w w w . j a v a 2s . c om*/ notificationPanel = new NotificationPanel(Constants.FEEDBACK); add(notificationPanel); form = new StatelessForm<>("login"); usernameField = new TextField<>("username", new Model<String>()); usernameField.setMarkupId("username"); form.add(usernameField); passwordField = new PasswordTextField("password", new Model<String>()); passwordField.setMarkupId("password"); form.add(passwordField); languageSelect = new LocaleDropDown("language"); form.add(languageSelect); domainSelect = new DomainDropDown("domain"); if (SyncopeConsoleSession.get().getDomains().size() == 1) { domainSelect.setOutputMarkupPlaceholderTag(true); } form.add(domainSelect); AjaxButton submitButton = new AjaxButton("submit", new Model<>(getString("submit"))) { private static final long serialVersionUID = 429178684321093953L; @Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { if (SyncopeConsoleApplication.get().getAnonymousUser().equals(usernameField.getRawInput())) { throw new AccessControlException("Illegal username"); } IAuthenticationStrategy strategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); if (AuthenticatedWebSession.get().signIn(usernameField.getRawInput(), passwordField.getRawInput())) { // If login has been called because the user was not yet logged in, than continue to the // original destination, otherwise to the Home page continueToOriginalDestination(); setResponsePage(getApplication().getHomePage()); } else { SyncopeConsoleSession.get().error(getString("login-error")); notificationPanel.refresh(target); } strategy.remove(); } }; submitButton.setDefaultFormProcessing(false); form.add(submitButton); form.setDefaultButton(submitButton); add(form); }
From source file:org.apache.syncope.client.console.pages.SAML2SPLogin.java
License:Apache License
public SAML2SPLogin(final PageParameters parameters) { super(parameters); String token = (String) ((ServletWebRequest) getRequest()).getContainerRequest().getSession() .getAttribute(org.apache.syncope.ext.saml2lsp.agent.Constants.SAML2SPJWT); if (StringUtils.isBlank(token)) { LOG.error("No JWT found, redirecting to default greeter"); PageParameters params = new PageParameters(); params.add("errorMessage", SAML_ACCESS_ERROR); setResponsePage(Login.class, params); }//from w ww . java 2 s .co m IAuthenticationStrategy strategy = getApplication().getSecuritySettings().getAuthenticationStrategy(); if (SyncopeConsoleSession.get().authenticate(token)) { if (parameters.get("sloSupported").toBoolean(false)) { SyncopeConsoleSession.get().setAttribute( org.apache.syncope.client.console.commons.Constants.BEFORE_LOGOUT_PAGE, SAML2SPBeforeLogout.class); } // If login has been called because the user was not yet logged in, than continue to the // original destination, otherwise to the Home page continueToOriginalDestination(); setResponsePage(getApplication().getHomePage()); } else { PageParameters params = new PageParameters(); params.add("errorMessage", SAML_ACCESS_ERROR); setResponsePage(Login.class, params); } strategy.remove(); }
From source file:org.apache.syncope.client.enduser.pages.SAML2SPLogin.java
License:Apache License
public SAML2SPLogin(final PageParameters parameters) { super(parameters); String token = (String) ((ServletWebRequest) getRequest()).getContainerRequest().getSession() .getAttribute(org.apache.syncope.ext.saml2lsp.agent.Constants.SAML2SPJWT); if (StringUtils.isBlank(token)) { LOG.error("No JWT found, redirecting to default greeter"); PageParameters params = new PageParameters(); params.add("errorMessage", SAML_ACCESS_ERROR); setResponsePage(getApplication().getHomePage(), params); }//from w ww . j a v a 2 s .c om IAuthenticationStrategy strategy = getApplication().getSecuritySettings().getAuthenticationStrategy(); if (SyncopeEnduserSession.get().authenticate(token)) { if (parameters.get("sloSupported").toBoolean(false)) { SyncopeEnduserSession.get().setAttribute(Constants.BEFORE_LOGOUT, SAML2SPBeforeLogout.class); } setResponsePage(getApplication().getHomePage()); } else { PageParameters params = new PageParameters(); params.add("errorMessage", SAML_ACCESS_ERROR); setResponsePage(getApplication().getHomePage(), params); } strategy.remove(); }
From source file:org.dcm4chee.wizard.common.login.SignInPanel.java
License:LGPL
/** * @see org.apache.wicket.Component#onBeforeRender() *//*from w ww.j a va 2 s.c om*/ @Override protected void onBeforeRender() { // logged in already? if (isSignedIn() == false) { IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); // get username and password from persistence store String[] data = jaasLoggedIn(this.getWebRequest()); if (data == null) { data = authenticationStrategy.load(); } if ((data != null) && (data.length > 1)) { // try to sign in the user if (signIn(data[0], data[1])) { username = data[0]; password = data[1]; // logon successful. Continue to the original destination continueToOriginalDestination(); // Ups, no original destination. Go to the home page throw new RestartResponseException( getSession().getPageFactory().newPage(getApplication().getHomePage())); } else { // the loaded credentials are wrong. erase them. authenticationStrategy.remove(); } } } // don't forget super.onBeforeRender(); }
From source file:org.jabox.webapp.pages.JaboxSignInPanel.java
License:Open Source License
/** * @see org.apache.wicket.Component#onBeforeRender() *//*from w w w. j a va 2 s.c o m*/ @Override protected void onBeforeRender() { // logged in already? if (isSignedIn() == false) { IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); // get username and password from persistence store String[] data = authenticationStrategy.load(); if ((data != null) && (data.length > 1)) { // try to sign in the user if (signIn(data[0], data[1])) { username = data[0]; password = data[1]; // logon successful. Continue to the original destination if (!continueToOriginalDestination()) { // Ups, no original destination. Go to the home page throw new RestartResponseException(getApplication().getSessionSettings().getPageFactory() .newPage(getApplication().getHomePage())); } } else { // the loaded credentials are wrong. erase them. authenticationStrategy.remove(); } } } // don't forget super.onBeforeRender(); }
From source file:org.onexus.ui.authentication.jaas.SignInPanel.java
License:Apache License
/** * @see org.apache.wicket.Component#onBeforeRender() *///from w w w . jav a2 s .c om @Override protected void onBeforeRender() { // logged in already? if (!isSignedIn()) { IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings() .getAuthenticationStrategy(); // get username and password from persistence store String[] data = authenticationStrategy.load(); if (data != null && data.length > 1) { // try to sign in the user if (signIn(data[0], data[1])) { username = data[0]; password = data[1]; // logon successful. Continue to the original destination continueToOriginalDestination(); // Ups, no original destination. Go to the home page throw new RestartResponseException( getSession().getPageFactory().newPage(getApplication().getHomePage())); } else { // the loaded credentials are wrong. erase them. authenticationStrategy.remove(); } } } // don't forget super.onBeforeRender(); }