Example usage for org.apache.wicket.authentication IAuthenticationStrategy load

List of usage examples for org.apache.wicket.authentication IAuthenticationStrategy load

Introduction

In this page you can find the example usage for org.apache.wicket.authentication IAuthenticationStrategy load.

Prototype

String[] load();

Source Link

Document

If "rememberMe" is enabled, then load the saved credentials (e.g.

Usage

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  . ja  v a 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  w  w w  .j a  v  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];/*  w ww  .j av a2s.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
            }/*from  w  w  w.jav  a 2  s. co m*/
            // 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.dcm4chee.wizard.common.login.SignInPanel.java

License:LGPL

/**
 * @see org.apache.wicket.Component#onBeforeRender()
 *//*from www.  j  a  v  a2s  .  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  v a  2 s .co  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   www  .  j  av a  2s . 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();
}

From source file:sf.wicklet.ext.auth.WxSignInPanel.java

License:Apache License

@Override
protected void onBeforeRender() {
    if (isSignedIn() == false) {
        final IAuthenticationStrategy authenticationStrategy = getApplication().getSecuritySettings()
                .getAuthenticationStrategy();
        final String[] data = authenticationStrategy.load();
        if ((data != null) && (data.length > 1)) {
            if (signIn(data[0], data[1])) {
                continueToOriginalDestination();
                throw new RestartResponseException(
                        getSession().getPageFactory().newPage(getApplication().getHomePage()));
            }/*from  w  w w.ja  va 2  s .c  om*/
            // the loaded credentials are wrong. erase them.
            authenticationStrategy.remove();
        }
    }
    super.onBeforeRender();
}