Using JDBC to implement username and password authentication

Hayde

I'm using JDBC to check a database for a username and password to grant login access to my gui, but when I'm trying to test that the JDBC is working its not blocking access when the wrong username and password is entered..

Below is my code, I believe its connecting the the database correctly, as when i press the login button it outputs Running Check Login and User is validated.

JB Nizet

Your checkLogin() method returns true if everything is OK, and false otherwise. But you don't check the result of the method in your UI, and thus proceed even if it returned false.

The code should do

try {
    boolean loggedIn = usernamecheck.checkLogin(jtfUsername.getText(), jtfPassword.getText());
    if (!loggedIn) {
        displayErrorMessage("Sorry, wrong credentials");
        return;
    }
}
catch (SQLException se) {
    e.printStackTrace();
    displayErrorMessage("Sorry, couldn't check your credentials. Check the logs and report the problem to an administrator.");
    return;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

get google authentication token using username and password

From Dev

Need to implement JDBC which checks username and password into my Gui

From Dev

Username and Password for LDAP Authentication

From Dev

GitHub Authentication from a WPF Application using Username & Password

From Dev

spring security authentication using ip address and username password

From Dev

Svn Authentication username, password and URL using Svn Kit

From Dev

Posting tweets using username and password authentication from Java app

From Dev

Git server with username and password authentication

From Dev

Client/server username/password authentication

From Dev

Authentication via username and password in Cassandra

From Dev

Authentication using username or email

From Dev

JDBC connection refused, default username password?

From Dev

Git clone with username password authentication in one go

From Dev

Authentication with username & password with node js, AngularJs and JWT

From Dev

Selfhosted WCF Service with SSL and Username and Password authentication

From Dev

remote: Invalid username or password, fatal: Authentication failed for

From Dev

Google Drive API username + password authentication

From Dev

How long can a basic authentication username/password be?

From Dev

Print username and password used in spring security authentication

From Dev

Chatting authentication of password and username to get IP and port

From Dev

Eclipse Luna Not Storing Proxy Authentication Username and Password

From Dev

Thrift sasl with username/password authentication for C++

From Dev

authentication -- making username and password global in java

From Dev

Eclipse Luna Not Storing Proxy Authentication Username and Password

From Dev

How to pass username and password to Spark-SQL when using JDBC data source?

From Dev

How to fetch username and password from url using basic authentication in node.js?

From Dev

Bypassing JConsole requirement for username/password - when using a Jaas custom login module with JMX to handle authorization and authentication

From Dev

Unsafe md5 How to get username and password for authentication using md5

From Dev

Basic authentication using http$ in Angular - Passing Username/Password and grant_type

Related Related

  1. 1

    get google authentication token using username and password

  2. 2

    Need to implement JDBC which checks username and password into my Gui

  3. 3

    Username and Password for LDAP Authentication

  4. 4

    GitHub Authentication from a WPF Application using Username & Password

  5. 5

    spring security authentication using ip address and username password

  6. 6

    Svn Authentication username, password and URL using Svn Kit

  7. 7

    Posting tweets using username and password authentication from Java app

  8. 8

    Git server with username and password authentication

  9. 9

    Client/server username/password authentication

  10. 10

    Authentication via username and password in Cassandra

  11. 11

    Authentication using username or email

  12. 12

    JDBC connection refused, default username password?

  13. 13

    Git clone with username password authentication in one go

  14. 14

    Authentication with username & password with node js, AngularJs and JWT

  15. 15

    Selfhosted WCF Service with SSL and Username and Password authentication

  16. 16

    remote: Invalid username or password, fatal: Authentication failed for

  17. 17

    Google Drive API username + password authentication

  18. 18

    How long can a basic authentication username/password be?

  19. 19

    Print username and password used in spring security authentication

  20. 20

    Chatting authentication of password and username to get IP and port

  21. 21

    Eclipse Luna Not Storing Proxy Authentication Username and Password

  22. 22

    Thrift sasl with username/password authentication for C++

  23. 23

    authentication -- making username and password global in java

  24. 24

    Eclipse Luna Not Storing Proxy Authentication Username and Password

  25. 25

    How to pass username and password to Spark-SQL when using JDBC data source?

  26. 26

    How to fetch username and password from url using basic authentication in node.js?

  27. 27

    Bypassing JConsole requirement for username/password - when using a Jaas custom login module with JMX to handle authorization and authentication

  28. 28

    Unsafe md5 How to get username and password for authentication using md5

  29. 29

    Basic authentication using http$ in Angular - Passing Username/Password and grant_type

HotTag

Archive