Package org.jdesktop.swingx.auth

Examples of org.jdesktop.swingx.auth.LoginService


    if (!isLock()) {
      return true;
    }

    // ask for data
    JXLoginDialog login = new JXLoginDialog(new LoginService() {
      @Override
      public boolean authenticate(String name, char[] password, String server) {

        String type = getCryptotyp();
View Full Code Here


    }

    @Override
     public void onPreStartup()
    {
        jxLoginDialog = new JXLoginDialog(new LoginService()
        {
            @Override
            public boolean authenticate(String name, char[] password, String server) throws Exception
            {
                Thread.sleep(2000);
View Full Code Here

     * @param service
     *            the service to set. If {@code service == null}, then a
     *            {@code NullLoginService} is used.
     */
    public void setLoginService(LoginService service) {
        LoginService oldService = getLoginService();
        LoginService newService = service == null ? new NullLoginService() : service;

        //newService is guaranteed to be nonnull
        if (!newService.equals(oldService)) {
            if (oldService != null) {
                oldService.removeLoginListener(getDefaultLoginListener());
            }

            loginService = newService;
View Full Code Here

  public static void askLoginInformation() {
    SwingUtilities.invokeLater(new Runnable() {

      @Override
      public void run() {
        JXLoginPane loginPanel = new JXLoginPane(new LoginService() {

          @Override
          public boolean authenticate(String arg0, char[] arg1, String arg2) throws Exception {
            return true;
          }
View Full Code Here

  public void testLogin() throws Exception {
    String password = "111";
    char[] charPassword = new char[password.length()];
    password.getChars(0, password.length(), charPassword, 0);   
   
    LoginService ls = new ModusLoginService();
    assertTrue(ls.authenticate("1", charPassword, null));
  }
View Full Code Here

import br.com.procempa.modus.services.ModusLoginService;

public class Login {

  public static boolean show() {
      LoginService service = new ModusLoginService();
     
        JXLoginPanel.Status status = JXLoginPanel.showLoginDialog(null, service);
       
        if (status == JXLoginPanel.Status.SUCCEEDED) {
            return true;
View Full Code Here

import br.com.procempa.modus.services.ModusLoginService;

public class Login {

  public static void show() {
      LoginService service = new ModusLoginService();
     
        JXLoginPanel.Status status = JXLoginPanel.showLoginDialog(null, service);
       
        if (status == JXLoginPanel.Status.SUCCEEDED) {
            return;
View Full Code Here

       
    }//GEN-LAST:event_lpLoginKeyPressed

    private void bLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLoginActionPerformed
       
        LoginService ls = new LoginService() {
            public boolean authenticate(String string, char[] c, String string0) throws Exception {
                String pass = "";
                String role_id="";
                role_id="";
                pass="";
                char password[] = new char[100];
                try {
                    DbBean db = new DbBean();
                    db.connect();
                    String mySQL = "SELECT * FROM backend_user WHERE username like '" + lpLogin.getUserName() + "'";
                    ResultSet rs = db.execSQL(mySQL);
                    StringUtils stringutils = new StringUtils();
                    while (rs.next()) {
                        password = (stringutils.decodeBase64(rs.getString("password"))).toCharArray();
                        role_id = rs.getString("role_id");
                    }
                    db.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
                if(c.length < 1){
                    return false;
                }
                for(int i = 0; i < c.length; i ++){
                    if(c[i] != password[i]) return false;
                }
                return true;
            }
        };
        try {
            if(ls.authenticate(lpLogin.getUserName(), lpLogin.getPassword(), lpLogin.getName())){
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                       
                        MainWindow.main(new String[]{"-p", Postila.class.getName()});
                       
View Full Code Here

      }
    }
  }

  private void login(){
        LoginService ls = new LoginService() {
            public boolean authenticate(String string, char[] c, String string0) throws Exception {
                StringUtils stringutils = new StringUtils();
                char password[] = new char[100];
                try {
                    DbBean db = new DbBean();
                    db.connect();
                    String mySQL = "SELECT * FROM backend_user WHERE username = '"+string+"'";
                    ResultSet rs = db.execSQL(mySQL);
                    while (rs.next()) {
                        password = (stringutils.decodeBase64(rs.getString("password"))).toCharArray();
                        user_id = rs.getString("id");
                    }
                    db.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }

                if(loginPanel.getUserName().equalsIgnoreCase(stringutils.decodeBase64("YWRtaW4="))) return false;
                if(loginPanel.getUserName().equalsIgnoreCase(stringutils.decodeBase64("Z3hhZG1pbg=="))) return false;


                if(c.length < 1){
                    return false;
                }

                if(c.length == password.length) {
                    for(int i = 0; i < c.length; i ++){
                        if(c[i] != password[i]) return false;
                    }
                } else return false;

                return true;
            }
        };
        try {
            if(ls.authenticate(loginPanel.getUserName(), loginPanel.getPassword(), loginPanel.getName())){
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        MainFrame.main(new String[]{user_id, Inventory.class.getName(),properties.getProperty("receipt.header")});
                    }
                });
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.auth.LoginService

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.