Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6968933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:30:59+00:00 2026-05-27T16:30:59+00:00

I am using apache shiro to authenticate a user and i want to simply

  • 0

I am using apache shiro to authenticate a user and i want to simply print the username out to my console to check if my finder function is working properly, it seems as when i add a record to the user (using a sql statement and not eclipseLink, the record is deleted when the application is run ?)

Here is how i am trying to retrieve a single user by username:

protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
    UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
    Map<String, String> map = new HashMap<String, String>();
    String tempUsername = token.getUsername();
    String password = "";
    Users user;

    // Null username is invalid
    if (tempUsername == null) {
        throw new AccountException("Null usernames are not allowed by this realm.");
    }
    AuthenticationInfo info = null;
    // this will query and find the users by the specified username and then return us the single result
    user = getAuthorizedUser(Users.findUsersesByUsernameEquals(tempUsername));
    System.out.print(user.getUsername());
    System.out.println("yea the username = ");
    password = user.getPassword();
    info = buildAuthenticationInfo(tempUsername, password.toCharArray());
    return info;
}
/*Build the required authentication info; Replace with SaltAuthenticationInfo for salted passwords*/
protected AuthenticationInfo buildAuthenticationInfo(String username, char[] password) {
          return new SimpleAuthenticationInfo(username, password, getName());
}

protected Users getAuthorizedUser(TypedQuery<Users> q){
    System.out.println("working authentication");

      return q.getSingleResult(); 
}

Is this because i am not using JPA to persist and add the user but rather writing a sql statement outside my application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:30:59+00:00Added an answer on May 27, 2026 at 4:30 pm

    I disabled this property <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>

    This was deleting my test records and solved my problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Apache Shiro in a web-application. The login and authentication check works
I'm using Apache Commons Logging and SLF4J with log4j, but I also want to
I'm using apache lucene for indexing and searching in my application. Everything is working
I am using Apache Solr for search. I use this to provide personal user-based
I am using apache-tomcat-6.0.18 and want to configure log4j for tomcat internal logging. I
Using Apache 2, I want to configure my website so that any requests to
I've been using Apache's StringEscapeUtils for HTML entities, but if you want to escape
We are using Apache ofbiz9.0 for our application. Now I want to execute a
Using Apache's commons-httpclient for Java, what's the best way to add query parameters to
Using Apache POI to generate a document and i'm having a small problem with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.