Package org.apache.wicket.authentication

Examples of org.apache.wicket.authentication.IAuthenticationStrategy


     * @see org.apache.wicket.markup.html.form.Form#onSubmit()
     */
    @Override
    public final void onSubmit()
    {
      IAuthenticationStrategy strategy = getApplication().getSecuritySettings()
        .getAuthenticationStrategy();

      if (signIn(getUsername(), getPassword()))
      {
        onSignInSucceeded();

        if (rememberMe == true)
        {
          strategy.save(username, password);
        }
        else
        {
          strategy.remove();
        }
      }
      else
      {
        onSignInFailed();
        strategy.remove();
      }
    }
View Full Code Here


  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
View Full Code Here

     * @see org.apache.wicket.markup.html.form.Form#onSubmit()
     */
    @Override
    public final void onSubmit()
    {
      IAuthenticationStrategy strategy = getApplication().getSecuritySettings()
        .getAuthenticationStrategy();

      if (signIn(getUsername(), getPassword()))
      {
        if (rememberMe == true)
        {
          strategy.save(username, password);
        }
        else
        {
          strategy.remove();
        }

        onSignInSucceeded();
      }
      else
      {
        onSignInFailed();
        strategy.remove();
      }
    }
View Full Code Here

  }

  @Override
  public boolean isSignedIn() {
    if (userId < 1) {
      IAuthenticationStrategy strategy = getAuthenticationStrategy();
      // get username and password from persistence store
      String[] data = strategy.load();
      if ((data != null) && (data.length > 2)) {
        // try to sign in the user
        if (!signIn(data[0], data[1], data[2])) {
          // the loaded credentials are wrong. erase them.
          strategy.remove();
        }
      }
    }
    return userId > -1;
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.authentication.IAuthenticationStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.